MySQL review notes II

Source: Internet
Author: User

MySQL review notes II 1. Set the password for the root administrator account. Generally, the default password for MySQL is null. If you have not set the root password before, use the mysqladmin command, you can use the following mysqladmin command to change the root password: $ mysqladmin-uroot-p password 123456 (equivalent to $ mysqladmin-u root-p password 123456) Enter password :( Enter the old password. Because the default password is blank, press enter here) 2. log on to the mysql database as a root administrator account $ mysql-uroot-p (equivalent to $ mysql-u root-p) Enter password: (enter the password set for the root account in the previous step) 3. After login, how can I identify whether the current login account is root? Enter the use mysql Command. If the command is executed successfully, the current Logon account is the root account. 4. How can I view the root password in the mysql system table (do not expect it to be in plain text )? # Use mysql in the system table; # query the password of the root account (the returned result is encrypted) select password from user where user = 'root '; 5. After logging on to the mysql database as a root account, how can I change the password of the root account by updating the system table? # Use mysql in the system table; # update the password of the root account by updating the system table. update user set PASSWORD = password ('000000') where user = 'root '; # Make the change take effect (if the following command is not executed, the new password will not take effect) flush privileges; 6. change the password of the root account with one command line # change the old password 12345 to the new password 54321 $ mysqladmin-u root-p 12345 password 54321 (equivalent to $ mysqladmin-uroot-p12345 password 54321)) VII. SQL statements related to database operations # view all databases show databases; # create a database named db (with certain permissions, root is allowed, but anonymous users are not allowed) create database db; # use a database named db; # delete a database named db drop database db; # exit the mysql database quit or exit. 8. log on to the mysql database $ mysql as an anonymous user. 9. log on to the mysql database $ mysql-h110.110.110.110-uroot-p123456 on the remote host;

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.