1、安裝mysqlmysql
sudo apt-get update sudo apt-get install mysql-server
2、配置sql
sudo mysql_secure_installation
在此階段須要選擇一些配置,根據本身需求選擇便可工具
3、測試測試
systemctl status mysql.service
4、配置遠程訪問code
sudo mysql -uroot -p GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456"; flush privileges;
而後更改/etc/mysql/mysql.conf.d/mysqld.cnfserver
註釋bind-address = 127.0.0.1get
但此時登錄mysql須要sudo命令,外部工具也沒法使用,在執行如下命令string
sudo mysql -uroot -p update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root'; flush privileges;