Hi guys
i've worked out how to create a database, show a database, and drop a database.
I've been trying to inport a sql file into a sql database.but it dont seem to work.
I got told to source the file with in the dir the sql file sit's.
mysql> source /home/tommytomato/downloads/nuke.sql
here is what i've done.
[root@www bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32 to server version: 3.23.58
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.00 sec)
mysql> create database nuke;
Query OK, 1 row affected (0.03 sec)
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| nuke |
| test |
+----------+
3 rows in set (0.00 sec)
mysql> \q
Bye
[root@www bin]# mysqladmin -u root -p drop nuke
Enter password:
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the 'nuke' database [y/N] y
Database "nuke" dropped
[root@www bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34 to server version: 3.23.58
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.00 sec)
mysql>
that was the test add show and drop, so that works.
now the bit i got told i dont quiet understand.
Quote:
At this prompt, type 'source thesqlfile.sql'
That will run the sql file. If the sql file doesn't have a use statement at the top of the file (use databasename)
then you need to type that before sourcing it. Also, when you run this command, be in the directory where the sql
file is residing at the moment (to avoid having to type a whole path to the sql file).
Hopefully that was clear enough, if it fails because of 'no database selected' then just issue a 'use foo;'
command (use databasename).
|
is the source the path to were the sql sits.
[root@www root]# cd /home/tommytomato/downloads
[root@www downloads]# ls
nuke.sql
any one tune me up abit please.
tommytomato