On Sun, 27 Mar 2005 06:39:58 +1200, Chris Hope
<bl*******@electrictoolbox.com> wrote:
MLH wrote:
I am having failures processing the following command and I wonder
if you can tell me what I must do in order to have success. When I try
to run source mysql_dump.sql.txt ==> it is a problem for me.
1) I put the file in /home/mlh/public_html/credifree/sql_script/.
2) I made that directory my current directory
3) I typed mysql and pressed ENTER
4) I then typed source mysql_dump.sql.txt and pressed ENTER
A bunch of error messages saying
ERROR 1046: No Database Selected
filled up the screen.
Well, of course there was no database selected. I do not yet have a
database. I thought the whole point of running
source mysql_dump.sql.txt
was to CREATE a set of database files on my linux box. Is that
incorrect? What must I do to avoid this error 1046?
Presumably your file doesn't have any create syntax in it so you need to
create the database first like so:
create database <database name>;
use <database name>;
source mysql_dump.sql.txt;
You are correct! There were lots of instances of CREATE TABLE but none
of CREATE DATABASE in the dump file. I tried to do what you said. I
typed mysql under my user login and pressed ENTER. The mysql> command
prompt appeared. I typed create database mydb and pressed ENTER. Here
is the error I got...
ERROR 1044: Access denied for user: '@localhost' to database 'mydb'
So, I exit'd mysql back to linux command prompt and logged in as the
super user and tried again. Here's the error I got typing mysql and
pressing ENTER...
ERROR 1045: Access denied for user: 'root@localhost' (Using password:
NO)
It seems I can't win for losing!
And now, the last question...
Can you tell me where the database files will be placed when running
source mysql_dump.sql.txt as I described above from the same current
directory as described above? I do wish to KNOW in advance where the
files will be created.
Depends on the configuration of MySQL. On my machine they're
in /var/lib/mysql. Why do you want to know where the files are though?
You won't be able to do anything with them because they're binary
files. If you want to back up your database you should use the
mysqldump command.
Its a force of habit, really - from the old DOS days. If it is not
important, then I won't lose any sleep over it. But I would be curious
to know what files are created and where.