Home>Article>Database> How to install and run mysql

How to install and run mysql

藏色散人
藏色散人 Original
2020-11-06 10:18:36 17821browse

mysql安装和运行的方法:首先下载Mysql并解压;然后进入bin目录, 打开cmd;接着执行命令“mysqld -install”来安装;最后进行初始化,并通过命令“net start mysql”启动mysql即可。

How to install and run mysql

推荐:《mysql视频教程

mysql下载安装与启动

Mysql自己下载

(按照我的步骤来应该不会遇到其它问题了,因为~~ ~~ ~~我踩了一遍坑把所有问题都解决了捋顺了才发出来的)


步骤详解:

  • 下载后解压,我的下载路径:
    D:\soft\mysql
  • 我的解压路径:
    D:\soft\mysql\mysql-8.0.11-winx64
  • 新建文件my.ini,my.ini 文件内容:
######################################################### [client] port=3306 default-character-set=utf8 [mysqld] port=3306 character_set_server=utf8 #安装路径 basedir=D:\\soft\mysql\mysql-8.0.11-winx64 #数据路径 datadir=D:\\soft\mysql\mysql-8.0.11-winx64\data sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [WinMySQLAdmin] Server=D:\\soft\mysql\mysql-8.0.11-winx64\bin\mysqld.exe #########################################################
  • 进入bin目录, 打开cmd
    How to install and run mysql
  • 安装: 执行mysqld -install
  • 初始化: 执行mysqld --initialize(这一步很必要,初始化data,必须要!)
  • 启动: 执行net start mysql
  • How to install and run mysql

注意事项

  1. 必须进入bin目录下进行安装、初始化与启动操作!否则会失败报错!
  2. 执行mysqld -install后必须执行mysqld --initialize!否则根本启动不起来!
  3. my.ini 文件中的路径盘符必须用双斜杠!!!否则虽然能安装成功,但是初始化和启动都会失败!

How to install and run mysql

关于密码

mysql会生成一个默认密码,我的
8.0版本默认密码在data路径下:机器名.err里
How to install and run mysql
用这个密码进去之后再修改密码就可以了
- 使用默认密码登陆
How to install and run mysql
修改密码为“123456”:
How to install and run mysql
ok拉,截图可以看看我测试命令哦,默认有这些数据库哈哈!

连接Navicat

Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误!
How to install and run mysql
解决方法如下:

  1. 登陆: mysql -u root -p
  2. 修改密码: ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘1
    23456’;
  3. 刷新权限: FLUSH PRIVILEGES;
    How to install and run mysql
    再次测试连接显示连接成功!
    How to install and run mysql

The above is the detailed content of How to install and run mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn