菜鸟驿站教程
Q1:编码格式不准确,模棱两可
I:\Save\Dairy\Mysql\mysql-8.0.19-winx64\bin>mysqld --initialize --console
2020-04-13T12:12:18.030891Z 0 [System] [MY-013169] [Server] I:\Save\Dairy\Mysql\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) initializing of server in progress as process 7832
2020-04-13T12:12:18.375544Z 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.
2020-04-13T12:12:48.254461Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: W>ul(l>Xd7gk
配置文件my.ini改为
[client]
# 设置mysql客户端默认字符集
default-character-set=UTF8MB4
[mysqld]
# 设置3306端口
port = 33306
# 设置mysql的安装目录
basedir=I:\\Save\\Dairy\\Mysql\\mysql-8.0.19-winx64
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\web\\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=UTF8MB4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
此时MySQL是初始化成功了的,只是默认编码有点问题,所以如果修改了配置文件重新初始化,则会出现错误
The designated data directory I:\Save\Dairy\Mysql\mysql-8.0.19-winx64\data\ is unusable. You can remove all files that the server added to it.
将data文件下的所有数据都删除即可。
Q2:输入错误
mysql install
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
应该是mysqld install
网友评论