Ubuntu20.10安装并配置mysql

安装mysql

https://blog.csdn.net/liang19890820/article/details/105071479

  1. 使用命令行安装:

    1
    sudo apt install mysql-server
  2. 配置mysql密码

    1
    sudo mysql_secure_installation
  3. 允许本地root直连
    进入mysql配置界面:

    1
    sudo mysql

    将认证方式改为密码登录:

    1
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

    查看用户登录方式:

    1
    mysql> SELECT user, authentication_string, plugin, host FROM mysql.user;
  4. 退出mysql

    1
    mysql> exit

这样就可以登录mysql了:mysql -uroot -p

安装一个mysql图形化界面

我选择了mysql-workbench,因为开源免费

1
snap install mysql-workbench-community