CentOS7上安装mysql8
先在官网下载个repo,安装repo,然后更新一下yum
1 2
| sudo yum clean all sudo yum makecache
|
查看一下
1
| yum repolist all | grep mysql
|
保证8是enable状态,可以修改
1 2 3
| yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql80-community
|
安装
1
| sudo yum install mysql-community-server
|
装完后启动
1 2
| sudo systemctl enable mysqld.service sudo systemctl start mysqld.service
|
去日志里看root的密码
用这个密码登录,操作之前先改一下密码,这时候密码策略还是复杂的,要改个长一点的。完了再改一下密码策略,然后就可以改简单密码了,平时测试用嘛,要那么复杂干嘛。
1 2 3 4
| alter user root@'localhost' identified by 'xxSS@@322434'; show variables like 'validate_password%'; set global validate_password.policy=0; set global validate_password.length=1;
|
记一要配置下字符集
1 2 3 4 5 6 7 8 9
| [client] default-character-set=utf8mb4
[mysql] default-character-set=utf8mb4
[mysqld] character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci
|
Ubuntu 20.04安装mysql
1 2 3
| sudo apt install mysql-server sudo systemctl start mysql sudo mysql_secure_installation
|