Ubuntu 16.04下安装mysql

安装

1
2
3
4
5
6
7
sudo apt-get update
sudo apt-get install mysql-server
sudo apt install mysql-client
sudo apt install libmysqlclient-dev
sudo apt-get install -f

sudo netstat -tap | grep mysql

配置mysql

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
1、注释掉bind-address = 127.0.0.1:
mysql-uroot-p你的密码

1
2
3
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
flush privileges;
service mysql restart

服务管理

启动

sudo service mysql start

停止

sudo service mysql stop

服务状态

sudo service mysql status