MySQL Common syntax

Source: Internet
Author: User

1. View the current database version
Select version (); 2. Maximum number of concurrent connections show VARIABLES like ' max_connections ';
3. See if things are automatically submitted
SHOW VARIABLES like ' autocommit '; 4. Query database character encoding
Show variables like ' character% '; 5. Modify the autogrow base by using the ALTER TABLE TABLE_NAME AUTO_INCREMENT=N command to reset the self-increment starting value.
SET Autocommit=off;


How to permanently change Character_set_server to Utf-8
sudo nano/usr/local/mysql/my.cnfdefault-storage-engine=innodbcharacter-set-server=utf8collation-server=utf8_ General_ci

1. cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql Copy the service file to INIT.D and rename it to Mysql2, chmod +x/etc/init.d /mysql gives executable permissions 3, chkconfig--add mysql add service 4, Chkconfig--list Show List of services if you see MySQL service and 3,4,5 are on, then success if is off, type chkconfig--level 345 mysql on5, reboot restart PC 6, Netstat-na | grep 3306, if you see a listening instruction, the service is started.

MySQL things isolation level

1. View the current session isolation level

SELECT @ @tx_isolation;

2. View the current isolation level of the system

SELECT @ @global. tx_isolation;

3. Set the current session isolation level

Set session transaction Isolatin level repeatable read;

4. Set the current isolation level of the system

Set global transaction ISOLATION level repeatable read;

5. Command line, when you start a transaction

Set Autocommit=off or start transaction


MySQL Auto Backup bat
Set "ymd=%date:~,4%%date:~5,2%%date:~8,2%"

mysqldump--opt-u root--password=root xiaoliao > D:\db_backup\bbs_%Ymd%.sql







Max_connections My.ini2. A shared database may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, the "MySQL" Database in the "User" table "host" item, from "localhost" renamed "%" 1. Mysql-u Root-pvmwaremysql>use mysql;2. Mysql>update User Set host = '% ' where user = ' root '; 3. Mysql>select host, user from user;

MySQL Common syntax

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.