...

View Full Version : ||| Error 1102 on Windows 2000 Pro hell!! |||



jaysun
11-14-2002, 12:08 PM
Hi all,

Being a mySQL virgin this is my first post and I apologise if it is a bit basic and has been answered many times before. I have searched this and other forums and cannot find an answer and am about to kill my computer, my pets and then myself ;)

I have a Windows 2000 setup (sorry!) and mySQL v2.32.52-nt and have been working with it for about a week now and have been getting on just fine. :)

However.......................

I started playing with using sql files to create databases and tables and insert data and everything was working fine and then all of a sudden things stopped working completely. SQL that had worked without a hitch started chucking up errors and I simply couldn't use files anymore????????

Now when I try to use a file to create db's, tables or insert data i simply get the following error:

ERROR 1102: Incorrect database name "<the location of the file>"

I have tried many things like creatibng the db first, using just the table create code and adding the db name in the command line call like so:

mysql -u root -D <dbname> -p "<the location of the file>"

And every other permatation of this just to make sure it's not me being an arse ;)

If anyone can help me I would REALLY appreciate it and you could save my life :)

TIA - Jaysun

.................now where's that cat!!!!!

P.S. Can anyone point me to some decent beginners web sites, forums etc. etc. apart from this one - Cheers :)

bcarl314
11-14-2002, 12:25 PM
Well, first lets see if you've got the steps correct.

You should do something like this:


c:\mysql\bin> mysql
mysql > show databases;

# This will show the databases available, test, & mysql are standard.
# if your db is not there, you will need to create it like so.


mysql > create database myDB;

#this will create a database named myDB
#next you will need to tell mySQL to use the DB, like so...


mysql > use myDB;

#now you can add tables 2 ways, on the command like like so.


mysql > create table myTable(id int auto_increment, field varchar(25), field2 varchar(30));

or, if you have your sql in an external file you can use...


mysql > source "c:/mydir/subdir/mySQLFile.sql";

remember to use forward slashes not backslashes.

Hope this helps.

jaysun
11-14-2002, 12:42 PM
hi bcarl314

thanks for your v.quick reply :)

my problem isn't with using the basic mySQL commands within mySQL like use and create etc. etc. it's when i try to use files from the shell/command line and not within mySQL :(

i haven't tried

mysql > source "c:/mydir/subdir/mySQLFile.sql";

so will give it a go and see what happens :)

thanks again for you time and help - cheers - jason

bcarl314
11-14-2002, 01:20 PM
I'm pretty sure on the source syntax, but you may want to check the "help" from within mysql, it will display the proper syntax.

jaysun
11-15-2002, 01:52 PM
hi bcarl314

thanks for your last post btw but my install must be really flakey as things have gone even weirder now LOL :)

i tried using 'source' and the first time it worked fine but when i tried to re-run the same sql it simply deleted it from the file??????

I think i'm getting a bit closer to the issue but being new to all this might be wrong :) I have managed to re-create the same problem using mySQL Front v2.5 (http://mysqlfront.venturemedia.de/ - top right for the software) in the following way........

1. Run mySQL Front & log on with the root user
2. Go to the query tab & 'Load SQL from text file' - load SQL

Here's my code.....
-----------------------------
create database office;

use office;

create table cust_details(
ID tinyint(5) auto_increment primary key not null,
FirstName tinytext,
LastName tinytext,
AddLine1 tinytext,
AddLine2 tinytext,
City tinytext,
PostCode varchar(10) not null,
Email varchar(40),
DayTel varchar(20),
key PostCode(PostCode)
);

create table products(
PID tinyint(6) auto_increment primary key not null,
ProductCode varchar(10),
ProductDesc tinytext,
Available varchar(10) default 'YES',
Price decimal(11,2) default '0.00'
);

create table orders(
OID tinyint(6) auto_increment primary key not null,
Date date not null default 'curdate()',
CustomerID tinytext,
Despatch varchar(10) default 'UPS',
DespatchDate date
);
-----------------------------

3. Excute SQL (F9) - it should work fine!!
4. Tools > Refresh to see the new database in the left pane.
5. Now drop the created 'office' database.
6. Go back to the 'Query' tab and re-run the SQL.

You should get : Unknown database 'office' error...........

7. Use Tools > Refresh again.
8. Re-run the SQL again.

All should work ok...............

this seems to point to the fact that when a db is created then dropped and then re-created you need to refresh mySQL. I have tried using:

shell> mysqladmin -u root -p reload

but to no effect :(

If you have any advice I really appreciate it as I'd simply like to know what's happening :)

tia - jaysun

bcarl314
11-15-2002, 02:31 PM
Do you usually use a GUI, or run from the command line? If you want a GUI, I'd suggest adding phpMyAdmin.

jaysun
11-16-2002, 11:17 AM
hi carl314

i've not really used GUI for mySQL at the moment to be honest as I wanted to be a geek and learn from the command line first so hopefully get a better understanding of what's going on in the back ground :)

I've just got a copy of phpMyAdmin so will have a look at it later.

Thanks for your help - Cheers - jaysun



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum