ubuntu安装mysql命令
1 | sudo apt-get install mysql-server |
按 Y 确认安装

ubuntu安装mysql
配置 Mysql 密码
1 | sudo mysql_secure_installation |

ubuntu安装mysql
检查是否运行
1 | systemctl status mysql.service |
提示 Active: active (running
表示正确安装且运行

ubuntu安装mysql
使用 mysql
1 | sudo mysql -uroot -p |
输入密码即可使用:

ubuntu安装mysql
配置 mysql 远程连接
1 | GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "你的密码"; |
*.*
代表所有数据库,如果要设置单个数据库可自行设置。
设置完后更新一下:
1 | flush PRIVILEGES; |

ubuntu安装mysql