Ubuntu16 uninstall install mysql5.7

From: https://www.jianshu.com/p/c76b31df5d09

Uninstall mysql:

sudo apt-get remove mysql-*

Query unloading residual files:

sudo find  / -name mysql -print

Will display the path containing the mysql file name:

/var/lib/mysql  
/var/lib/mysql/mysql  
/var/log/mysql  
/usr/bin/mysql  
/usr/lib/mysql  
/usr/share/mysql  
/etc/mysql  
/etc/init.d/mysql

Completely remove residues:

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

Install mysql server and client:

sudo apt-get install mysql-server mysql-client

During the installation process, you will be prompted to set the root password, and the setting will work (it will not be prompted if the residue is not removed)
. It will automatically run after installation.
Check whether mysql is running

sudo service mysql status

It shows that it is running! [Insert picture description here] (https://img-blog.csdnimg.cn/20191204164835956.png) If it is
not running, you can run it manually

sudo service mysql start

log in:

mysql -uroot -p

Check if mysql is running:

sudo netstat -tap | grep mysql

The picture has been successful

navicat remote connection configuration:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

Modify the /etc/mysql/mysql.conf.d/mysqld.cnf file

bind-address=127.0.0.1改为:bind-address=0.0.0.0

Restart mysql:

/etc/init.d/mysql restart

OK.

Published 52 original articles · praised 34 · 10,000+ views

Guess you like

Origin blog.csdn.net/weixin_43789195/article/details/103787246