Overview:
This blog is no longer on the MySQL grammar to explain and explain, want to know or familiar with the friends please Baidu or Google to learn. This blog is mainly for MySQL except grammar summary, hope can also help you.
1.centos6.x MySQL forgot root password solution
Ⅰ. Modifying login settings for MySQL
# VIM/ETC/MY.CNF
Add one sentence to the [mysqld] paragraph: skip-grant-tables
Ⅱ. Restart Service
# Service Mysqld Restart
Ⅲ. Log in to MySQL, change password information
# MySQL
mysql> use MySQL;
mysql> UPDATE user SET Password=password (' New-password ') WHERE user= ' root ';
mysql> flush Privileges;
Mysql> quit
Ⅳ. Restoring MySQL Login settings
# VIM/ETC/MY.CNF
Add a skip-grant-tables comment to the paragraph in [mysqld] or delete
Ⅴ. Restart Service
# Service Mysqld Restart
2.centos6.x modifying MySQL default encoding
Ⅰ. Log in to MySQL view encoding format
Show variables like ' character% ';
Ⅱ. Copying my-large.cnf files to/etc/my.cnf
Cp/usr/share/doc/mysql-server-4.1.12/my-large.cnf/etc/my.cnf
Ⅲ. Edit the My.cnf file to modify the default encoding format
Vim/etc/my.cnf
Add Default-character-set=utf8 in the [mysqld] Segment
Add Default-character-set=utf8 in the [client] segment
Ⅳ. # service MYSQLD Restert # Restart Services
Ⅴ. Verifying the success of the modification: show variables like ' character% ';
Use mysql--to forget root password and modify MySQL default code under Linux