The basic operation of MySQL

Source: Internet
Author: User

the command to log in to MySQL is mysql: mysql [-u username] [-h host] [-p[password]] [dbname]

MySQL directory:

Database directory:/var/lib/mysql/

Configuration file:/usr/share/mysql(mysql.server command and configuration file)

Related commands:/usr/bin (mysqladmin mysqldump and other commands )

Startup script:/etc/rc.d/init.d/(startup script file mysql directory)

Modify mysql login password: usr/bin/mysqladmin-u root password ' new-password '

MySQL start and stop: /etc/init.d/mysql start/usr/bin/mysqladmin-u root-p shutdown

MySQL autostart :/sbin/chkconfig –list/sbin/chkconfig – add MySQL ( added to Autostart list )/sbin/chkconfig – del MySQL ( Delete auto start list ) 

To add a mysql User:

Grant SELECT on database . * to User name @ Login host identified by " password "

Grant Select,insert,update,delete on * * to [e-mail protected] "%" identified by "123";

backup and Recovery for MySQL:

Mysqldump-u root-p--opt ( configuration item ) ( Library or table ) > Back.sql

Mysql-u root-p ( Library or table ) < Back.sql

MySQL optimization tool

Show status Explain optimize ( allows you to recover space and merge data file fragments , optimize currently only works on myiasm< /c6> and BDB tables )

The basic operation of MySQL

Related Article

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.