Win10安装MySQL8.0.16过程记录

目录

参照菜鸟教程:https://www.runoob.com/mysql/mysql-install.html的步骤

一、使用Windows的管理员cmd进行操作

解压目录:默认8.0MySQL不提供my.ini文件了,需要自己创建。

 my.ini

开始安装:

二、另外需要注意的是Windows路径一定要用\\,这样mysql的数据库信息数据就被灌入data目录下。

三、修改用户名密码:

更改加密方式尝试:

修改初始密码、修改成远程登陆记录(亲测)

四、修改远程连接

五、忘记密码怎么办?



参照菜鸟教程:https://www.runoob.com/mysql/mysql-install.html的步骤

一、使用Windows的管理员cmd进行操作

解压目录:默认8.0MySQL不提供my.ini文件了,需要自己创建。

 my.ini

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\\software\\mysql-8.0.16-winx64\\bin
datadir=D:\\software\\mysql-8.0.16-winx64\\data
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# 允许最大连接数
max_connections=100
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

开始安装:

cmd管理员,记得记录下随机密码,不要忽略掉,在cmd中用鼠标选中随机密码,然后右键点击其他地方一下,即复制下来了然后保存到一个文档中,等待接下来登陆MySQL以及修改初始密码。

C:\Windows\system32>d:

D:\>cd software\mysql-8.0.16-winx64\bin

D:\software\mysql-8.0.16-winx64\bin>mysqld --initialize --console
2019-06-19T15:03:15.614181Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server in progress as process 4716
2019-06-19T15:03:15.615094Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file 'D:\software\mysql-8.0.16-winx64\bin\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2019-06-19T15:03:15.621460Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-06-19T15:03:19.650531Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: M>,oa2rEKkho
2019-06-19T15:03:21.235150Z 0 [System] [MY-013170] [Server] D:\software\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server has completed

D:\software\mysql-8.0.16-winx64\bin>mysqld install
Service successfully installed.

D:\software\mysql-8.0.16-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

二、另外需要注意的是Windows路径一定要用\\,这样mysql的数据库信息数据就被灌入data目录下。

三、修改用户名密码:

use mysql;    
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
FLUSH PRIVILEGES;
quit
mysql -uroot -p

 修改密码的方式学习https://blog.csdn.net/belug/article/details/81081040

更改加密方式尝试:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

或者

alter user 'root'@'localhost' identified with mysql_native_password by 'amp';
mysql -h localhost -u root -p

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

修改初始密码、修改成远程登陆记录(亲测)


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> update user set host='%' where user='root';
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>

四、修改远程连接

mysql> use mysql
Database changed
mysql> update user set host='%' where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.07 sec)

五、忘记密码怎么办?

转载:https://www.cnblogs.com/jerrys/p/10626408.html

发布了127 篇原创文章 · 获赞 35 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/shunzi2016/article/details/90522231
今日推荐