MySQL Common script

Source: Internet
Author: User
Tags mysql client

First, start the MySQL service
1, the way one
A, Win+r: Open the Run window
b, input services.msc Open the Service settings interface
C. Find MySQL service, start or deactivate

2, the way two did not test pass
A, Win+r: Open the Run window
B. Switch directory: cd C:\Program files\mysql\mysql Server 5.5\bin
C, execute command: mysqld--console


Second, start the MySQL client
1, the way one
A, click the MySQL command icon directly, enter the password into

2, Mode two
A, Win+r: Open the Run window
B. Switch directory: cd C:\Program files\mysql\mysql Server 5.5\bin
C, execute command: mysql-uroot-p123456


Iii. Execute SQL script file
1, the way one
A. Go to MySQL command window
B. Select database: Use Test
C, execute script: source E:\TestBoKe\student.sql

2, Mode two
A. Go to MySQL command window
B. Select database: Use Test
C, execute script: \. E:\TestBoKe\student.sql


Iv. export all tables in MySQL database test (the export script does not contain the CREATE DATABASE statement)
1. Win+r: Open the Run window
2. Switch directory: cd C:\Program files\mysql\mysql Server 5.5\bin
3. Execute command: mysqldump test-uroot-p123456 > E:\TestBoKe\testTable.sql


V. Export MySQL database Test (export script contains CREATE DATABASE statement)
1. Win+r: Open the Run window
2. Switch directory: cd C:\Program files\mysql\mysql Server 5.5\bin
3. Executive order: mysqldump test-uroot-p123456--database > E:\TestBoKe\test.sql


Vi. Write batch file Execute script export database
1. Create Bakup.txt
2. Write down script in file
C:
CD C:\Program files\mysql\mysql Server 5.5\bin
Mysqldump test-uroot-p123456--database > E:\TestBoKe\test.sql
3. Change the file suffix to. bat
4. Click File to Run



Vii. Common Scripts
Show databases: see which databases are available
Use test: Enter test database
Show tables: see which table


VIII. database replication

Mysqldump stu-uroot-p--opt | MySQL tea-uroot-p123456-h 192.168.31.239



MySQL Common script

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.