1. 程式人生 > >mysql之匯入資料

mysql之匯入資料

linux 命令列匯入資料

將sql檔案放到登入mysql庫的命令的當前目錄下

[root@izwz91h49n3mj8r232gqwez opt]# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 49
Server version: 5.6.42-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates.
All rights reserved. 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> CREATE DATABASE IF NOT EXISTS yiibaidb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
mysql> use yiibaidb; mysql> source yiibaidb.sql;

備註 yiibaidb.sql 都是yiibaidb這個資料庫裡的表以及資料