數(shù)據(jù)庫(kù)安裝完成后,默認(rèn)是不能遠(yuǎn)程登陸的,只能在本地用localhost 或者127.0.0.1登錄訪(fǎng)問(wèn),如果需要遠(yuǎn)程登錄,則需要修改mysql設(shè)置,具體修改方式:
1、本地登錄mysql:?
[root@localhost ~]$ mysql -u root -p123456
2、查看數(shù)據(jù)庫(kù)中mysql表中的權(quán)限設(shè)置:
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host, user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
3 rows in set (0.00 sec)
3、修改root用戶(hù)權(quán)限:
mysql> update user set host = ‘%’ where user = ‘root’;
4、此時(shí),root用戶(hù)的權(quán)限已經(jīng)允許非localhost登錄文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-570864.html
mysql> select host, user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+---------------+
3 rows in set (0.00 sec)
5、最后,刷新設(shè)置,即可遠(yuǎn)程登錄文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-570864.html
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
到了這里,關(guān)于message from server: “Host is not allowed to connect to this MySQL server“問(wèn)題的解決辦法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!