Windows 安装 MySQL8

MySQL8下载地址:官网

解压到安装目录

C:App\Mysql

新建配置文件my.ini

[mysqld]
# 设置mysql的安装目录
basedir=C:\App\Mysql
# 设置mysql数据库的数据的存放目录
datadir=C:\App\Mysql\data
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4

[mysqld_safe]
log-error=C:\App\Mysql\error.log
pid-file=C:\App\Mysql\mysqld.pid

[mysql]
default-character-set=utf8mb4

[client]
default-character-set=utf8mb4

管理员方式运行命令行,进入C:App\Mysql\bin

//删除旧MySQL服务

sc delete mysql

//初始化数据库,记录随机密码

mysqld --initialize --console

//安装mysql

mysqld.exe -install

//启动mysql

net start mysql

//修改密码

mysql -u root -p

alter user root@localhost identified by 'root';(caching_sha2_password认证插件)

alter user root@localhost identified with mysql_native_password by 'root';(mysql_native_password认证插件)

posted @ 2019-03-02 10:15  绿静風  阅读(152)  评论(0编辑  收藏  举报