Instance parsing: The Command identified by MySQL instance manager _ MySQL

Source: Internet
Author: User
Once you have set a password file for the MySQL instance manager and IM is running, you can connect to it. You can use the mysql client tool to connect to mysql through the standard MySQLAPI. The following is a list of commands that can be received by the MySQL instance manager. STARTINSTANCEinstance_name this command will try to start an instance: mysqlSTARTIN

Once you have set a password file for the MySQL instance manager and IM is running, you can connect to it. You can use the mysql client tool to connect to MySQL through the standard mysql API. The following is a list of commands that can be received by the MySQL instance manager.

     ·START INSTANCE 
     

This command will try to start an instance:

     mysql> START INSTANCE mysqld4;Query OK, 0 rows affected (0,00 sec)·STOP INSTANCE 
     

Will try to stop an instance:

     mysql> STOP INSTANCE mysqld4;Query OK, 0 rows affected (0,00 sec)·SHOW INSTANCES

Show all loaded instance names:

     mysql> show instances;+---------------+---------+| instance_name | status  |+---------------+---------+| mysqld3       | offline || mysqld4       | online  || mysqld2       | offline |+---------------+---------+3 rows in set (0,04 sec)·SHOW INSTANCE STATUS 
     

Displays the status and version information of the selected instance:

     mysql> SHOW INSTANCE STATUS mysqld3;+---------------+--------+---------+| instance_name | status | version |+---------------+--------+---------+| mysqld3       | online | unknown |+---------------+--------+---------+1 row in set (0.00 sec)·SHOW INSTANCE OPTIONS 
     

Display the options used by the instance:

     mysql> SHOW INSTANCE OPTIONS mysqld3;+-------------+--------------------------------------------------+|option_name  | value                                            |+-------------+--------------------------------------------------+|instance_name| mysqld3                                          ||mysqld-path  | /home/cps/mysql/trees/mysql-4.1/sql/mysqld       ||port         | 3309                                             ||socket       | /tmp/mysql.sock3                                 ||pid-file     | hostname.pid3                                    ||datadir      | /home/cps/mysql_data/data_dir1/                  ||language     | /home/cps/mysql/trees/mysql-4.1/sql/share/english|+-------------+--------------------------------------------------+7 rows in set (0.01 sec)·SHOW 
     
       LOG FILES
     

This command provides all the log files used by the instance. The result contains the path and size of the log file. If the path of the log file (such as log =/var/mysql. log) is not specified in the configuration file, IM tries to guess its location. If the IM cannot guess the location of the log file, you should specify the location of the log file.

     mysql> SHOW mysqld LOG FILES;+-------------+------------------------------------+----------+| Logfile     | Path                               | Filesize |+-------------+------------------------------------+----------+| ERROR LOG   | /home/cps/var/mysql/owlet.err      | 9186     || GENERAL LOG | /home/cps/var/mysql/owlet.log      | 471503   || SLOW LOG    | /home/cps/var/mysql/owlet-slow.log | 4463     |+-------------+------------------------------------+----------+3 rows in set (0.01 sec)·SHOW 
     
       LOG {ERROR | SLOW | GENERAL} size[,offset_from_end]
     

This command is used to find a part of a specified log file. Because most users focus on the latest log messages, use the size parameter to define the number of bytes you want to obtain from the end of the log. You can specify the optional offset_from_end parameter to request data from the central log file. In the following example, 21 bytes of data can be requested, starting from the end of the log file with 23 bytes and ending with 2 bytes:

     mysql> SHOW mysqld LOG GENERAL 21, 2;+---------------------+| Log                 |+---------------------+| using password: YES |+---------------------+1 row in set (0.00 sec)·SET instance_name.option_name=option_value

This command is used to edit the configuration file of the specified instance to change/add instance options. IM assumes that the configuration file is located in/etc/my. cnf. You should check whether the file exists and have proper permissions.

     mysql> SET mysqld2.port=3322;Query OK, 0 rows affected (0.00 sec)

Changes made to the configuration file will not take effect until the MySQL server is restarted. In addition, after the flush instances command is executed, these changes will be saved to the local cache of the Instance set value of Instance Manager.

     ·UNSET instance_name.option_name

This command deletes an option from the instance configuration file.

     mysql> UNSET mysqld2.port;Query OK, 0 rows affected (0.00 sec)

Changes made to the configuration file will not take effect until the MySQL server is restarted. In addition, after the flush instances command is executed, these changes will be saved to the local cache of the Instance set value of Instance Manager.

     ·FLUSH INSTANCES

This command forces IM to repeat the configuration file and clear the internal structure. Run this command after editing the configuration file. This command does not restart the instance:

     mysql> FLUSH INSTANCES;Query OK, 0 rows affected (0.04 sec)

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.