Linux系统下mysql数据库安装配置步骤:
1.在服务器上安装mysql:
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
检测mysql是否安装成功
sudo netstat -tap | grep mysql
2.执行MySQL命令授权:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
刷新权限:
flush privileges;
3.安装vim编辑器:
sudo apt-get install vim-gtk
安装完毕之后可以vi +Tab一下看看是否成功
编辑mysqld.cnf
在ubuntu16.04中,需要编辑的是/etc/mysql/mysql.conf.d/mysqld.cnf
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
修改mysqld.cnf文件:
bind-address = 0.0.0.0
允许指定ip
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.106' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.103' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
4.注意:如果上述限制ip的方法不成功时, 可以先使用root登录在可视化的navicat中手动添加用户并且赋予一定的权限(select)即可!