Database file import and export operations, and privileged SQL statements

Source: Internet
Author: User
Tags dba

1, export database xxxx and TLog (after testing, no problem)
#/data/mysql/bin/mysqldump-u Root-ppassword qq9x | gzip >/home/xxxxdatabase.sql.gz
#/data/mysql/bin/mysqldump-u Root-ppassword TLog | gzip >/home/tlogdatabase.sql.gz
2. Export to local documents
Under the SFTP
#get-R/home/xxxxdatabase.sql.gz
#get-R/home/tlogdatabase.sql.gz
2. Import data (path is/home)
"Directly execute the above exported script, the following test, no problem, but xxxxdatabase.sql this script is relatively large, so it is time-consuming"
(some files require use of database; then you need to select database.) Therefore, it is possible to execute SQL scripts under the QQ9X database.
#/data/mysql/bin/mysql-u Root-p--password=passwordqq9x < Xxxxdatabase.sql

Execute SQL script under TLog this database
#/data/mysql/bin/mysql-u Root-p--password=passwordTLog < Tlogdatabase.sql

Direct import of Execute SQL script (no database required)
#/data/mysql/bin/mysql-u Root-p--password=password< Xxxx_create_db.sql
#/data/mysql/bin/mysql-u Root-p--password=password< Tlog.sql

        After executing this statement, the DBA user has the table query, insert, UPDATE, and TestDB for orders (table) in the database. The right to delete this write operation.
5. Revoke the permissions that have been given to the MySQL user.
    Revoke is similar to Grant's syntax, just replace the keyword "to" with "from":
    grant  all on *. * TO&NB sp;  [email protected];
  /revoke permission  
   revoke  all  on  * *  from  [email  protected];

6, grant or revoke, the user must reconnect to the MySQL database, the permissions to take effect.
If you want to authorize users, you can also grant these permissions to other users, requiring "grant option"
Grant Select on testdb.* to [e-mail protected] with GRANT option;
After the execution of this sentence, the effect is that the DBA user has the right to query all the table structures in TestDB
This feature is generally not available, in fact, database permissions are generally best managed by DBAs. This statement should be a statement executed under a normal user. That's why this right is realized.
7, delete the MySQL user xxxx SQL statement:

Execute under Root: DELETE from mysql.user where user = ' xxxx ';

8, NoSQL database and relational database design concept comparison:

Tables in a relational database are stored in a formatted data structure, and each tuple field is the same, even if not all of the fields are required for each tuple, but the database assigns all the fields to each tuple, which makes it easy to connect the table to the table. But from another point of view it is also a factor of relational database performance bottleneck. The non-relational database is stored in key-value pairs, its structure is not fixed, each tuple can have a different field, each tuple can add some of their own key-value pairs as needed, so that the fixed structure will not be limited, you can reduce the cost of some time and space.

Database file import and export operations, and privileged SQL statements

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.