p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   MySQL (http://p2p.wrox.com/forumdisplay.php?f=99)
-   -   problem creating database (http://p2p.wrox.com/showthread.php?t=14691)

nusrati June 27th, 2004 08:21 AM

problem creating database
I am very new to MYSQL.

I. installed MYSQL on W2k sever from MYQSL website. I am using a book to learn MYSQL.

2. after installing I started mysql using command prompt (mysqld-max)

3. i did comand mysql -uadmin

C:\mysql\bin>mysql -uadmin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 3.23.58-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

4. When I do the following I get

mysql> status
mysql Ver 11.18 Distrib 3.23.58, for Win95/Win98 (i32)

Connection id: 14
Current database:
Current user: admin@localhost
Server version: 3.23.58-max
Protocol version: 10
Connection: localhost via TCP/IP
Client characterset: latin1
Server characterset: latin1
TCP port: 3306
Uptime: 20 hours 48 min 7 sec

Threads: 1 Questions: 27 Slow queries: 0 Opens: 6 Flush tables: 1 Open tabl
es: 0 Queries per second avg: 0.000


5. then when i do following i get error

mysql> create database testdb;
ERROR 1044: Access denied for user: '@localhost' to database 'testdb'
mysql> status

I exactly followed the steps of the book, can some tell me what i did wrong..I have not created any user yet. according to the book "At this point I am the root user who has access to everything", then i do not know why i can not create database...


happygv June 27th, 2004 08:37 PM

Hi there,

You haven't logged into your mysql properly. That is what the error denotes. You should login using username and password.

C:\mysql\bin>mysql -uroot -pYOURPASSWORD

Does your admin user have no password set to it? How you say you are logged in as root? If you are successfully logged in as root you should see any such error(may be some permission issue kind of errors) shown as

ERROR 1044: Access denied for user: 'root@localhost' to ....

Since you are not logged in successfully as any user, you see it as @localhost. So you got to login to accomplish that.

Hope that helps.

-Vijay G
[8]Strive for Perfection[8]

nusrati June 27th, 2004 10:32 PM

thanks for your reply. you were right. i was able to take care by doing the follwing...

C:\mysql\bin>mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.58-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql> create database testdb;
Query OK, 1 row affected (0.01 sec)


Let me ask you something else ....have you tried MYSQL GUI "DataKonsultAB" that you download from MYSQL website. When I go to window exlorer and click on the mysqlgui-win32-static-1.7.7-2 I get this interface that ask me for pasword, what should I enter there?, I have not set up any password yet.


happygv June 27th, 2004 10:56 PM

Sorry, I have not used that - DataKonsultAB, so I am not sure about the password thing.

But I have used "Mysql Control Center". You can download that from Mysql website if you are interested.


-Vijay G
[8]Strive for Perfection[8]

Daniel Walker June 28th, 2004 07:02 AM

Are you sure there's a package called "DataKonsultAB"? I thought "TcX DataKonsultAB" was the former name of MySQL AB, the company that makes MySQL?

Take it easy

nusrati June 28th, 2004 07:50 AM

I went to MYSQL site and in download section and under "Graphical clients" you will see "MYSQLGUL" link. I thought that was the GUI clinet for MYSQL so you create database from there instaed of command prompt, may be I was wrong.

Whats is "Mysql Control Center", is it GUI client for MYSQL used to create databases/tables etc.


Daniel Walker June 28th, 2004 09:22 AM

In a word, yes. Officially, it's still in late-Beta relaese, but it seems stable enough for me, when I use it (which isn't all that often, I'll admit). The one thing it can't do, is generate schema diagrams. At a push, you can use the fairly loathsome Access, to do that, if you need to, by importuing the table structures into an mdb file.


Daniel Walker June 28th, 2004 10:06 AM

FWIW, you may also want to look into MySQL Administrator, as well, which is a much more substantial program. It has things like user administration, service controls (if logged in from localhost), as well as things like remote backup, realtime displays of the laod on your connection, and suchlike.

nusrati June 28th, 2004 03:13 PM

Thanjks for your message. i was able to create database using "Control Center". One thing I wanted to ask you, Is it possible to make foreign key (FK)in MYSQL tables , bcz I did not see the option for the foreign key. Other thing is how do we create relation (PK-FK) in MYSQL, bcz I did not any option for that too.


Daniel Walker June 29th, 2004 04:48 AM

You need to CREATE all your tables as TYPE=InnoDB. The traditional MyISAM data engine MySQL AB originally built dos not enforce key constraints. A good place to start out, when learning about using foreign keys is probably the MySQL manual:

You'll find a full description of how to go about building your key constraints. The main thing to watch out for, is to make sure that both the fields (PK in the parent table and FK in the foreign table) are off exactly the same datatype, and that the indexing requirements have been met. MySQL simply won't allow you to create the constraint, otherwise. It's actually a fair bit more rdgid in how it assigns and enforces foreign keys than is the case with simple desktop packages, like Access, since the aim is to preserve the speed of the queries run against the data. Foreign keys are a powerful tool, but they sap speed if they are not designed with care.

All times are GMT -4. The time now is 12:10 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.