1 安装
apt-get install mysql-server
查看MySQL状态
service mysql status
2 设置
设置root密码:
mysql
设置密码
set password for 'root'@'localhost' = password('Admin@123');
设置root可远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'Admin@123' WITH GRANT OPTION;
3 修改配置
修改配置前请先关闭MySQL数据库服务
service mysql stop
vim /etc/mysql/mysql.conf.d/mysqld.cnf
设置远程访问
注释bind-address = 127.0.0.1
启动MySQL:
service mysql start
查看MySQL状况:
service mysql status