# Modification of coding
“`python
show variables like ‘%char%’; #View the current encoding
1.Open configuration file:
vim /etc/mysql/my.cnf
2.After [client] and [mysqld], add:
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
3.Restart mysql:
service mysql restart
“`
# mysqlreset password
“`python
#1.Open configuration file:
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
2. Add in the [mysqld] segment:
skip-grant-tables #Skip permission to start MySQL
3.Restart MySQL
service mysql restart
4.Log in with root, without password.
mysql -uroot -p
5.Change Password
use mysql #Choose a library at random.
update mysql.user set authentication_string=password(‘juhao’) where user=’root’;
update mysql.user set plugin=’mysql_native_password’;
flush privileges ;
6.Open the configuration file, delete the fourth step, restart the MySQL service.
“`