 |
MySQL General discussion about the MySQL database. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

June 27th, 2004, 08:21 AM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
problem creating database
Hi,
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
--------------
mysql>
************
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...
Thanks
|

June 27th, 2004, 08:37 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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.
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|

June 27th, 2004, 10:32 PM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
Thanks
|

June 27th, 2004, 10:56 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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.
Cheers!
_________________________
-Vijay G
 Strive for Perfection 
|

June 28th, 2004, 07:02 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
Dan
|

June 28th, 2004, 07:50 AM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
Thanks
|

June 28th, 2004, 09:22 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
Dan
|

June 28th, 2004, 10:06 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

June 28th, 2004, 03:13 PM
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
Thanks
|

June 29th, 2004, 04:48 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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:
http://dev.mysql.com/doc/mysql/en/In...nstraints.html
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.
|
|
 |