問題:最近開始用mysql8惠况,結(jié)果發(fā)現(xiàn)在sql語法比之前的版本嚴(yán)格了許多。。此處先解決授權(quán)sql報(bào)錯(cuò)問題贯城,報(bào)錯(cuò)如下
mysql> grant all on dev1_test1.* to dev1@'%' identified by '12345678';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by '12345678'' at line 1
解決:mysql8 要求先建用戶,后授權(quán)
# 新增用戶霹娄、授權(quán)
mysql> create user admin@'%' identified by 'kFONVz22';
mysql> GRANT all on *.* TO admin@'%';
mysql> flush privileges;
# 取消授權(quán)
msyql> revoke all ON *.* FROM admin@'%';
轉(zhuǎn)載自:https://blog.csdn.net/qq_40168110/article/details/96859947
然后打開mysql默認(rèn)的3306端口
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
然后允許使用舊的密碼驗(yàn)證方式:
ALTER USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
最后 sqlyog就可以遠(yuǎn)程登陸了能犯。
如果先安裝了一個(gè)版本的鲫骗,再安裝新版本,需要先把舊版本的數(shù)據(jù)刪除悲雳,否則啟動(dòng)不起來挎峦,重點(diǎn)是刪除 /var/lib/mysql下的所有文件
密碼強(qiáng)度修改:0 是low, 1是medium,2是high
select @@validate_password_policy
set global validate_password_policy=0;
update mysql.user set authentication_string=password('new password') where user='root' ;
允許root 遠(yuǎn)程登錄:
grant all privileges on . to 'root'@'%' identified by 'password' with grant option;
select host,user from user where user='root'
flush privileges;