navicat localhost可连mysql但无法用ip连接

2025-05-08 15:03:00

1、Windows的mysql:解决办法:C:\Users\Administrator>net start mysqlC:\Users\Administrator>mysql -uroot -p1234注:-p后面的1234是密码,注意修改。

2、赋予所有用户远程连接权限:mysql>grant all privileges on *.* to 'root'@'%' identified by '1234';

navicat localhost可连mysql但无法用ip连接

3、解释:*.*:表示 所有数据库.所有表%:所有ipby后面为数据库密码,注意按实际修改。刷新配置:mysql>flush privileges;湔溴亍腧退回cmd命令行:mysql>quit;重新启动mysql:C:\Users\Administrator>net stop mysqlC:\Users\Administrator>net start mysql

4、CentOs lampp mysql:解谛忖认噤决办法:进入mysql命令行:[root@Master bin]# /opt/lampp/bin/mysql -uroot -p呶蓟鹭毵Enter password:Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 7Server version: 10.1.32-MariaDB Source distributionCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]>

5、进入mysql web管惯栲狠疲理界面,浏览器输入:ip/phpadmin修改mysql数据库中User表里面root用户的%字段的密码为123456,赋予所有用户远程登录权限:MariaDB [(none)]>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;刷新配置:MariaDB [(none)]>FLUSH PRIVILEGES;命令退出mysql:MariaDB [(none)]>quit;重启服务:/opt/lampp/lampp restart

6、这时候采用navicat等工具就可以远程连接并操作数据库了。

7、over!大功告成啦

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢