1.直接mysql進入:
[root@rhel6 bin]# mysql
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 3
server version: 5.5.22 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.
2.進入mysql後執行,發現失敗,這是因為沒有進入相應的資料庫
mysql> source /home/db2inst1/createtable.sql
error 1046 (3d000): no database selected
error 1046 (3d000): no database selected
error 1046 (3d000): no database selected
error 1046 (3d000): no database selected
error 1046 (3d000): no database selected
error 1046 (3d000): no database selected
3.顯示下當前存在的資料庫(或者自己建立乙個均可)
mysql> show databases;
+--------------------+
| database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
4.這裡直接使用test資料庫
mysql> use test;
database changed
5.檢視下test下面的表
mysql> show tables;
empty set (0.00 sec)
發現沒有表
6.正好我們要執行的sql檔案就是建表的指令碼
mysql> source /home/db2inst1/createtable.sql;
error 1051 (42s02): unknown table 'aastudent'
error 1051 (42s02): unknown table 'aacourse'
error 1051 (42s02): unknown table 'aasc'
error 1051 (42s02): unknown table 'aateacher'
query ok, 0 rows affected (0.07 sec)
query ok, 0 rows affected (0.01 sec)
query ok, 0 rows affected (0.01 sec)
query ok, 0 rows affected (0.00 sec)
query ok, 1 row affected, 2 warnings (0.01 sec)
query ok, 1 row affected, 2 warnings (0.00 sec)
query ok, 1 row affected, 2 warnings (0.01 sec)
執行成功。
7.發現我們的表已經建立好了,就是 學生,老師和課程表的那個例子
mysql> show tables;
+----------------+
| tables_in_test |
+----------------+
| aacourse |
| aasc |
| aastudent |
| aateacher |
+----------------+
4 rows in set (0.00 sec)
結束。
Inno Setup執行SQL指令碼的方法
作為和nsis並立的 兩個最流行的免費windows應用程式安裝包製作工具之一,inno在學習難度上相對要低一些,非常適合對一些簡單的桌面程式打包。但對於較複雜的安裝過程,或者web應用程式來說,我個人覺得不是inno的強項。當然,既然inno內嵌了pascal語言用以擴充套件功能,理論上不是不可以...
Inno Setup執行SQL指令碼的方法
作為和nsis並立的 兩個最流行的免費windows應用程式安裝包製作工具之一,inno在學習難度上相對要低一些,非常適合對一些簡單的桌面程式打包。但對於較複雜的安裝過程,或者web應用程式來說,我個人覺得不是inno的強項。當然,既然inno內嵌了pascal語言用以擴充套件功能,理論上不是不可以...
Inno Setup執行SQL指令碼的方法
作為和nsis並立的 兩個最流行的免費windows應用程式安裝包製作工具之一,inno在學習難度上相對要低一些,非常適合對一些簡單的桌面程式打包。但對於較複雜的安裝過程,或者web應用程式來說,我個人覺得不是inno的強項。當然,既然inno內嵌了pascal語言用以擴充套件功能,理論上不是不可以...