sudo apt-get install mysql-server sudo apt install mysql-client sudo apt install libmysqlclient-dev
service mysql status
mysql -u root -p
use mysql; update user set plugin='mysql_native_password' where user='root'; update user set authentication_string=password('123') where user='root'; flush privileges; exit;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
在mysqld.cnf中[mysqld]中加入mysql
skip-grant-tables
例如: sql
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables
輸入命令mysql -u root 進入mysql;
重複正常正如mysql修改命令的方法數據庫
sudo /etc/mysql/mysql.conf.d/mysqld.cnf #進入服務端中修改 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock character-set-server=utf8 #指定服務端編碼
sudo vim /etc/mysql/conf.d #打開客戶端配置文件 [mysql] default-character-set=utf8 #指定客戶端編碼