前面安裝教程建議參考:https://www.runoob.com/mysql/mysql-install.html
安裝前准備: 刪除 mysql數據庫 和mariadb 自帶的數據庫(若有)
只說下安裝后容易遇到的坑:
密碼重置:
/etc/my.cnf
配置: skip-grant-tables 這樣可以不輸入密碼進入mysql
進入mysql,首先刷新權限
flush privileges;
然后查看表結構,可以看到密碼字段是authentication_string
update user set authentication_string=password('123456') where user='root';
flush privileges;
用戶授權遠程訪問:
#創建賬戶
create user 'root'@'%' identified by 'password'
#賦予權限,with grant option這個選項表示該用戶可以將自己擁有的權限授權給別人
grant all privileges on *.* to 'root'@'%' with grant option
#改密碼&授權超用戶,flush privileges 命令本質上的作用是將當前user和privilige表中的用戶信息/權限設置從mysql庫(MySQL數據庫的內置庫)中提取到內存里
flush privileges;
mysql 客戶端遠程登陸:Client does not support authentication protocol requested by server ; consider upgrading MySQL client
解決方案:1升級驅動 大家可以試一下
2 修改數據庫加密規則
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密碼';
FLUSH PRIVILEGES;