954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

what to do with this .SQL script?

hi, in order to install my php gallery, i have to "Run the photos.sql script in your MySQL database" what does this mean? i know i have mysql, as i have a phpBB2 forum running. but how do i do this? thanks

kubota
Newbie Poster
3 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

somthing like

mysql < photos.sql


should do the trick

Paul.Esson
Junior Poster
181 posts since Feb 2005
Reputation Points: 21
Solved Threads: 10
 

??? but i wanted to know how to add it to my MySQL database :O

kubota
Newbie Poster
3 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

mysql mydatabasesname < photos.sql

Paul.Esson
Junior Poster
181 posts since Feb 2005
Reputation Points: 21
Solved Threads: 10
 
mysql mydatabasesname < photos.sql


errrr.....have you actually read my question, your an idiot or what, if ya not gonna help, fade away.......

kubota
Newbie Poster
3 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Well hmm, Yes I did, LETS say i have a database called test !! and a mysql script that looks like such

[root@Kat root]# cat pont.sql
#DROP TABLE `test`
#CREATE TABLE test(nick VARCHAR(30), about VARCHAR(30));

INSERT INTO test () VALUES ("Paul.Esson" , "Trying to be nice" );
INSERT INTO test () VALUES ("kubota" , "Idiot");
SELECT * FROM test


because I do, Now I wish to run this script

[root@Kat root]# mysql test < pont.sql
nick    about
Paul.Esson      Trying to be nice
kubota  Idiot
Paul.Esson      Trying to be nice
kubota  Idiot
Paul.Esson      Trying to be nice
kubota  Idiot
[root@Kat root]#


It works for me

You might try reading the man pages ?

[root@Kat root]# man mysql | tail -n 20 | head -n 5
EXAMPLE
       You can also read a backup dump file back into MySQL with:

       mysql  database < backup-file.sql


So basicly what you need to do is open up some kinda console
start > run > cmd

in windows

then you need to make certain that mysql is in your path, prolly easyest to change to the mySQL dir, then you type

mysql theDatabaseName < C:\path\to\the\file\photowhatever.sql

and pray it should hopfully work without a hitch.

Paul.Esson
Junior Poster
181 posts since Feb 2005
Reputation Points: 21
Solved Threads: 10
 

Do you have phpMyAdmin installed? If not, then INSTALL IT. It's the best way to work with MySQL for dummies (even experts use it, very easy to use.) I'm sure you already have it installed on your webhost, though. Then just import the file in phpMyAdmin.

Gary King
PHP/vBulletin Guru
Team Colleague
417 posts since Nov 2003
Reputation Points: 53
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You