1.mysql5.7

1.完全卸载mysql

  1. sudo rm /var/lib/mysql/ -R && sudo rm /etc/mysql/ -R && sudo apt-get autoremove mysql* --purge && sudo apt-get remove apparmor

2.安装mysql

https://zhuanlan.zhihu.com/p/348317883

  1. mkdir -p /opt/mysql
  2. cd /opt/mysql
  3. wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar
  4. tar xf mysql-server_5.7.31-1ubuntu18.04_amd64.deb-bundle.tar
  5. sudo apt-get update && apt-get upgrade && apt-get install -y libaio1 libtinfo5
  6. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 467B942D3A79BD29
  7. sudo dpkg -i mysql-common_5.7.31-1ubuntu18.04_amd64.deb
  8. sudo dpkg-preconfigure mysql-community-server_5.7.31-1ubuntu18.04_amd64.deb
  9. sudo dpkg -i libmysqlclient20_5.7.31-1ubuntu18.04_amd64.deb
  10. sudo dpkg -i libmysqlclient-dev_5.7.31-1ubuntu18.04_amd64.deb
  11. sudo dpkg -i libmysqld-dev_5.7.31-1ubuntu18.04_amd64.deb
  12. sudo dpkg -i mysql-community-client_5.7.31-1ubuntu18.04_amd64.deb
  13. sudo dpkg -i mysql-client_5.7.31-1ubuntu18.04_amd64.deb
  14. sudo dpkg -i mysql-common_5.7.31-1ubuntu18.04_amd64.deb
  15. sudo apt-get -f install
  16. sudo apt-get -f install libmecab2
  17. sudo dpkg -i mysql-community-server_5.7.31-1ubuntu18.04_amd64.deb
  18. sudo dpkg -i mysql-server_5.7.31-1ubuntu18.04_amd64.deb

3.远程访问

1.创建远程访问用户

  1. #
  2. use mysql;
  3. create user admin@host identified by '输入密码';
  4. GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY '输入密码';
  5. flush privileges;
  6. exit

2.修改bind

  1. cd /etc/mysql/mysql.conf.d
  2. vim mysqld.cnf
  3. reboot