mysql匯入source資料庫

2022-01-30 04:29:47 字數 1100 閱讀 7702

首先要確保資料庫存在,如果不存在則建立

很智慧型,很方便,很快捷。

# mysql -uroot -p

enter password:

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 54467

server version: 5.6.36-log source distribution

oracle is a registered trademark of oracle corporation and/or its

affiliates. other names may be trademarks of their respective

owners.

type 'help;' or '\h' for help. type '\c' to clear the current input statement.

mysql> use wenbo

database changed

mysql> source ./wenbo_test.sql

query ok, 0 rows affected (0.00 sec)

query ok, 0 rows affected (0.04 sec)

query ok, 0 rows affected (0.00 sec)

你可以執行很多次都沒有關係。

可以執行資料庫,可以執行單個表,都是可以的。

mysql> source ./wenbo_online.sql
如果sql中是整個資料庫,那麼source之後,整個資料庫都變了。如果只是整個表的資料,那麼整個表的資料都變了。

mysql -uroot -p wenbo < ./wenbo_test.sql
效果跟source一樣,只是沒有執行過程。

tips:匯出資料用mysqldump

mysqldump -uroot -p wenbo > ./wenbo_test.sql

mysql匯入source資料庫

首先要確保資料庫存在,如果不存在則建立 很智慧型,很方便,很快捷。mysql uroot p enter password welcome to the mysql monitor.commands end with or g.your mysql connection id is 54467 se...

mysql中用source命令匯入sql檔案

mysql中source命令匯入sql檔案 小例子mytest emp dept.sql檔案,內容如下 create table emp eid int primary key auto increment,ename varchar 20 not null,e varchar 10 deptid ...

mysql 匯入sql檔案,source命令

今天碰到個問題要用phpmyadmin匯入1g的資料,但是在怎麼都匯入不了,用命令列就可以輕鬆搞定了。用mysql source命令可以匯入比較大的檔案。mysql use dbtest mysql set names utf8 mysql source d www sql back.sql 通過s...