mysql安装

执行命令apt list | grep "mysql"查找mysql软件包
找到软件包,执行apt install mysql-server-8.0/focal-security安装mysql
执行mysql进入mysql

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "123456";
Query OK, 0 rows affected (0.01 sec)

mysql> exit;
Bye

修改密码为123456
下次登陆使用命令mysql -uroot -p,然后输入密码登陆

mycli安装

mycli是一个mysql命令行工具,具有sql语句提示的功能

输入apt install mycli安装mycil
使用方法
登陆mycli -uroot,然后输入密码登陆

posted on 2022-10-11 20:36  hongweiwang408  阅读(20)  评论(0)    收藏  举报