MySQL4.0 Command Action Learning notes

Source: Internet
Author: User

Disclaimer: The following is not original, just a recent study notes collation.

--------------------------------------

Go to the MySQL installation path bin directory:


1. Turn on the service


Winmysqladmin.exe


Enter follow the prompts:


Enter winmysqladmin initial user, password (note: MySQL user, password) fill in the necessary meaning


2. root directory password reset


Mysqladmin-u root-p Password 123456


Enter appears


Enter Password: (Note: Call to enter the original password. The password is empty at the time of installation, the direct enter is the)


At this point the MySQL account root password is changed to 123456 installation completed!


3. Log in to MySQL:


Mysql-u User name-p user Password


4. Displays the list of databases.


show databases;


Description: There are two databases by default: MySQL and test. MySQL inventory in the MySQL system and user rights information, we change the password and the new user, is actually to operate the library.


5. Display the data table in the library:


Use MySQL
Show tables;


6. Displaying the structure of a database table


describe table name;


7. Create the database and delete the database:


Create database name;
drop database name;


8. Build tables and Delete tables:


Use library name;
CREATE TABLE table name (field list);
drop table name;


9. Clear the records in the table:


Delete from table name;


10. Display the records in the table:


SELECT * from table name;


11. Export Data:


Mysqldump--opt Test > Mysql.test


Description


Export the database test database to the Mysql.test file, which is a text file


12. Import Data:


Mysqlimport-u root-p123456 < Mysql.dbname


13. Import text data into the database:


Description: The field data for text data is separated by the TAB key.


Use test;
Load data local infile "file name" into table name;


14. Clear invalid and Error commands:


\c


15. Exit


\q


16. View Help


\h

-------------------------------------------------------

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.