1. yum安裝
安裝教程: https://blog.csdn.net/managementandjava/article/details/80039650
其中指定默認(rèn)安裝路徑:yum install mysql-community-server
2. 設(shè)置root簡單密碼
1. 查看默認(rèn)密碼:grep "A temporary password" /var/log/mysqld.log
2. 設(shè)置弱密碼登錄
修改配置文件: vim /etc/my.cnf
在最尾行加上: skip-grant-tables
保存文件
然后重啟mysql: service mysqld restart
然后免密碼登錄mysql: mysql -uroot -p
然后依次執(zhí)行:
use mysql
update user set authentication_string='' where user='root'
最后執(zhí)行:quit
再次修改my.cnf掌挚, 將末尾添加的 skip-grant-tables 刪掉
然后重啟mysql: service mysqld restart
使用空密碼登錄mysql: mysql -uroot -p
然后依次執(zhí)行:
use mysql
select user,host from user;(查看用戶角色)
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
設(shè)置密碼復(fù)雜度為最低級(jí):
set global validate_password.policy=0 ;
set global validate_password.length=6;
修改密碼為弱密碼:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
3. 開放遠(yuǎn)程訪問
https://blog.csdn.net/weixin_40079336/article/details/81395590