sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common //这个很重要
上面的其实有一些是多余的。
清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
sudo apt-get updatesudo apt-get install mysql-client-core-5.7sudo apt-get install mysql-client-5.7sudo apt-get install mysql-server-5.7ps -ef | grep mysqlnetstat -tap | grep mysqlservice mysql stop
如果不是root用户请执行
sudo service mysql stopservice mysql startservice mysql restartvim /etc/mysql/my.cnf
重启msyql
service mysql restart
2、授权非本机用户登陆数据库
登录数据库
执行命令
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
刷新权限
FLUSH PRIVILEGES;