MySQL use at the command line

Source: Internet
Author: User

1. Installation of MySQL under Mac: http://my.oschina.net/joanfen/blog/171109


2. Before using MySQL, make sure that the MySQL service in "System number Setup" is turned on


3. Open "Terminal", enter "Mysql-uroot-p" and enter the password you defined at the time of installation.


4. Basic Operation statement

(1) Show databases; (Show all databases )

(2) Use Pkusz; (using a database, Pkusz is one of my database names)

(3) Show tables;


5. Export the SQL file

(1) Use "terminal" to enter the path you want the file to export, such as Desktop

(2) then enter "Mysqldump-uroot-p Pkusz > Pkusz.sql" and enter the database password finally

(3) A file with the name of SQL suffix will be exported


6. Import SQL file

(1) First use "terminal" to enter the database

(2) Create a database with the same name as the SQL file

(3) Mysql>source pkusz.sql; Can


Related Article

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.