1.登录服务器的数据库   mysql -uroot -p(密码)  

2.创建用户用来远程连接,创建用户为maliang,密码也是maliang

GRANT ALL PRIVILEGES ON *.* TO 'maliang'@'%' IDENTIFIED BY 'maliang' WITH GRANT OPTION;

3.执行 flush privileges;命令立即生效

 flush privileges;

4.查询数据库的用户

SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

5.使用exit命令退出MySQL

6.

/etc/init.d/mysqld stop

/etc/init.d/mysqld start

7.naticat 连接



Logo

更多推荐