The actual operation process of MySQL database commands

Source: Internet
Author: User

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

 
 
  1. 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.

 
 
  1. 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

 
 
  1. /etc/init.d/MySQL stop  
  2. /etc/init.d/MySQL start  

Run the MySQL database command

 
 
  1. show variables like 'character%';  
  2. +--------------------------+----------------------------+  
  3. | Variable_name | Value |  
  4. +--------------------------+----------------------------+  
  5. | character_set_client | utf8 |   
  6. | character_set_connection | utf8 |   
  7. | character_set_database | utf8 |   
  8. | character_set_filesystem | binary |   
  9. | character_set_results | utf8 |   
  10. | character_set_server | utf8 |   
  11. | character_set_system | utf8 |   
  12. | character_sets_dir | /usr/share/MySQL/charsets/ |   
  13. +--------------------------+----------------------------+  
  14.  

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.