查看 mysql 依赖项
dpkg --list|grep mysql
卸载 mysql
sudo apt-get remove mysql-common
sudo apt-get autoremove --purge mysql-server-5.7
dpkg -l|grep ^rc|awk '{print$2}'|sudo xargs dpkg -P
sudo apt-get autoremove --purge mysql-apt-config
安装 mysql
sudo apt install mysql-server mysql-client
sudo cat /etc/mysql/debian.cnf
mysql -u*** -p***
修改 root 账号密码
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('1234') where user='root' and Host ='localhost';
mysql> update user set plugin="mysql_native_password";
mysql> flush privileges;
设置远程连接
mysql> use mysql;
mysql> select host, user, authentication_string, plugin from user;
mysql> create user 'root'@'%' identified by '1234';
mysql> grant all privileges on *.* to 'root'@'%';
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1234';
mysql> flush privileges;
mysql> quit;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
sudo service mysql restart
启动 mysql
sudo /etc/init.d/mysql start
sudo service mysql start
停止 mysql
sudo /etc/init.d/mysql stop
sudo service mysql stop
重启 mysql
sudo/etc/init.d/mysql restart
sudo service mysql restart
|