MySQL Database basic commands

Source: Internet
Author: User

1. See what databases are in the current server

2. See what tables are in the MySQL database

3. View the structure of the Users table

4. Create a new database auth and tables users


5. Delete the users table and the AUTH database

6. Inserting data

7. Querying data

Delete and change the statement and SQL Server statement exactly the same, can refer to SQL Server statement, here no longer detailed demonstration

8, the user authorization of the database
1) Create a new user Xiaoqi and give the SELECT permission to all tables in the AUTH database


2) Log in to the server using Xiaoqi

BR/>3) Create a new database BDQN, and authorize the host connection from the IP address 192.168.4.19, the user name is Dbuser, the password is [email protected], allowing any action to be taken in the BDQN database

4) View Permissions
Show grants for ' dbuser ' @ ' 192.168.4.19 '
5) Revoke Permissions
First look at the permissions that are already available

EXECUTE command REVOKE permission revoke all on auth.* from ' xiaoqi ' @ ' localhost '
View Permissions again


9. Backup and Recovery of database
Backing up tables, backing up libraries, backing up all libraries

10. Delete the table users and then restore


View table has been restored


11. If the backup file already includes complete database information, you do not need to specify the library name when performing the import operation, for example: Recovering the Auth Library from the backup file Auth.sql
First enter the database storage directory: Cd/usr/local/mysql/data, then execute the command

MySQL Database basic 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.