Windows Navicat 连接虚拟机(ubuntu)中Mysql 数据库

Ubuntu安装数据库:

sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev

安装过程中会要去设置数据库root用户密码。

数据库登陆:

sudo mysql -uroot -p[passwd]

修改数据库为远程可登陆:

编辑文件:

sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉文件中的:

bind-address = 127.0.0.1: -> #bind-address = 127.0.0.1:

执行授权命令:

mysql>grant all on *.* to root@'%' by '[your password]' with grant option;
...
mysql>flush privileges;
...
mysql>quit;

重启服务器:

service mysql restart

Windows端Navicat连接mysql服务器

其中主机为虚拟机Ip地址,可以用`ifconfig`命令查看。

猜你喜欢

转载自blog.csdn.net/jekcai/article/details/81569650