The following articles mainly describe the application of MySQL database commands. The first reason is to increase the related permissions of a user, this article shows the application of MySQL database commands on the relevant website two days ago. I hope to help you in this regard.
1. Enhance the permissions of a user
Dbname specifies the user
- grant all on *.* to sfsuser@'%';
2: Restore from the backup file
MySQL-usfsuser-p111111 dbname <file path/file name;
3: log on to MySQL remotely.
- MySQL -h10.0.0.1 -usfsuser -p111111;
4: Set the default data Character Set
Vi/etc/my. cof
Find the client configuration [client] and add it below
Default-character-set = utf8 default character set: utf8
Add in [MySQLd]
Default-character-set = utf8 default character set: utf8
Init_connect = 'set NAMES utf8'
Restart MySQL
- /etc/init.d/MySQL stop
- /etc/init.d/MySQL start
Run the MySQL database command
- show variables like 'character%';
- +--------------------------+----------------------------+
- | Variable_name | Value |
- +--------------------------+----------------------------+
- | character_set_client | utf8 |
- | character_set_connection | utf8 |
- | character_set_database | utf8 |
- | character_set_filesystem | binary |
- | character_set_results | utf8 |
- | character_set_server | utf8 |
- | character_set_system | utf8 |
- | character_sets_dir | /usr/share/MySQL/charsets/ |
- +--------------------------+----------------------------+
-
5. Slow query logs
Add
Log-slow-queries =/var/lib/MySQL/slowquery. log (specify the location where the log file is stored, which can be empty and the system will give a default file host_name-slow.log)
Long_query_time = 2 (including all 5. * series, before 5.1.21) Slow query logs are in seconds by default, and the time later than the millisecond record is 10 s by default)
Log-queries-not-using-indexes, if you want to enable the control, it is best to install the microtime slow query patch to avoid misunderstanding that some records are slow queries. for example, you can perform the count (*) operation on the entire table and other operations that do not use indexes but are fast)
Log-long-format (if it is set, all queries without indexes will be recorded)
After the database is restarted, use show variables to check whether the corresponding fields take effect;
6: show processlist; query the SQL statement being executed.
The above content is an introduction to MySQL database commands, and I hope you will get some benefits.
Original article title: MySQL Command
Connection: http://www.cnblogs.com/highhigh/archive/2010/02/24/1672410.html