下载安装包:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
dpkg -i mysql-apt-config_0.8.13-1_all.deb
更新源:
apt-get update
安装mysql:
apt-get -y install mysql-server
输入两边密码,等待安装完成
修改配置文件
vim /etc/mysql/mysql.conf.d/mysqld.cnf ,修改bind-address 为当前服务器IP地址
启动mysql:
systemctl restart mysql
查看mysql状态
systemctl status mysql
设置开机自启:
systemctl enable mysql
开启远程访问:
命令登录mysql
mysql –uroot –p’xxxxx’
grant all privileges on *.* to root@'%'identified by 'xxxxxxx';