使用Navicat连接云服务器上的mysql数据库
使用PuttY登录服务器
login as : ubuntu
登录mysql
# mysql - u root - p
Enter password:
给所有远程登录的用户赋予权限(默认个root用户) grant all privileges on 库名.表名 to ‘用户名’@‘IP地址’ identified by ‘密码’ with grant option;
mysql> GRANT ALL PRIVILEGES ON * . * TO root@'%' IDENTIFIED BY 'root' with grant option;
刷新MySQL的系统权限
mysql> flush privileges;
修改配置文件/etc/mysql/mysql.conf.d/mysqld.cnf
# cd / etc/ mysql/ mysql. conf. d
# sudo vi mysqld. cnf
找到bind-address =‘127.0.0.1’,改为bind-address = 0.0.0.0然后保存退出
# Instead of skip- networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind- address = 0.0 .0 .0
重启mysql服务
# sudo service mysql restart
打开Navicat,新建MySQL连接 连接名自己起 主机名或IP地址填服务器的IP地址 端口默认3306 用户名和密码使用数据库用户root/root 点击连接测试 测试成功后点击确定