源码包下载下来文件根目录新建my.ini 内容如下[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\mysql\
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
初始化
管理员模式下命令行进入到mysql的bin目录下mysqld --initialize --console
记下这个密码,待会需要用到
安装为服务mysqld --install Mysql8
把服务启动
连上mysql此时还无法正常使用
ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo
re executing this statement.
需要初始化密码alter user 'root'@'localhost' identified by 'youpassword';
flush privileges;