MySQL Common commands

Source: Internet
Author: User

1. Connect to MySQL. Command format: mysql-h host address-u user name-P user password. For example mysql -h 10.110.15.120 -u root -p 123***2. Change the password. Command format: Mysqladmin-u username-P old password-password new password.
    • Add a password to root: Root does not have a password at the beginning, so the- mysqladmin -u root -password 新密码 p old password is the province column.
3. Add a new user. Command format: grant 权限1,权限2,权限3...权限n on 数据库名称.表名称 [email protected]用户地址 identitied by ‘密码‘
    • For example:grant select,insert,update,delete,create,drop on databasename.datatable to [email protected] identified by ‘mima‘
4. Displaying the database show databases5. Backup DATABASE command format: mysqldump-h hostname-P Port-u user name-p password-database database name Table name > file name, sql
    • Export the entire database
      mysqldump -u user_name -p *** database_name > outfile.sql

    • Export a table
      mysqldump -u user_name -p *** database_name table_name > outfile.sql

MySQL Common commands

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.