时间:2021-07-01 10:21:17 帮助过:5人阅读
ubuntu@thanlon-ubuntu:~$ sudo apt install mysql-server
debian.cnf:
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = xxVQEIYEftGPHsx4
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = xxVQEIYEftGPHsx4
socket = /var/run/mysqld/mysqld.sock
ubuntu@thanlon-Ubuntu:~$ mysql -udebian-sys-maint -p
mysql> SHOW DATABASES;
mysql> USE mysql
【注意:必须使用数据库mysql,使用其它数据库是不可以的】:
4、修改用户名和密码(“123456”是密码,“root”是用户名):
mysql> update user set authentication_string=PASSWORD("123456") where user=‘root‘;
mysql> update user set plugin="mysql_native_password";
mysql> flush privileges;
5、重启mysql服务
ubuntu@thanlon-ubuntu:~$ /etc/init.d/mysql restart;
6、使用修改后的用户名和密码登录MySql
ubuntu@thanlon-Ubuntu:~$ mysql -uroot -p
ubuntu18.04.2LTS下安装和配置MySql数据库 --Linux
标签:mysqld data auto database soc main rate date font