Command for MySQL to import database. SQL file in Ubuntu

Source: Internet
Author: User
Tags import database

First, build a database in Ubuntu, such as temp.

Mysql-h localhost-u root-p temp

You will be prompted to enter the password.

2. import data:

The syntax is mysqldump-opt database name <c: \ data. SQL

The example is mysqldump-hlocalhost-uroot-p123456 zf or

Mysqlimport-hlocalhost-u root-p123456 & lt; c: \ data. SQL

3. Import text data to the database:

Use Database Name;

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

Step 6: Create a database table

Create table mytable (name VARCHAR (20), sex CHAR (1 ));

7. Add records to the table

Insert into table name values ("1", "2 ″);

8. Use text to load data into database tables

Load data local infile "c:/data. SQL" INTO TABLE name;

9. Import the. SQL FILE command (for example, c:/data. SQL)

Use database;

Source c:/data. SQL

10. Update table data

Update MYTABLE set sex = "f" where name = 'hyq ';

11th repair table

Repair table name

12th view the table size

Show table name status

13th Change Password

Mysqladmin-u username-p old password "new password"

14th Modify Table Structure

Alter table t1 MODIFY B BIGINT NOT NULL;

14th quit MYSQL Command

Exit or quit (Press ENTER)

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.