Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 27th, 2004, 08:21 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Reply With Quote
  #2 (permalink)  
Old June 27th, 2004, 08:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #3 (permalink)  
Old June 27th, 2004, 10:32 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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



Reply With Quote
  #4 (permalink)  
Old June 27th, 2004, 10:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #5 (permalink)  
Old June 28th, 2004, 07:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6 (permalink)  
Old June 28th, 2004, 07:50 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #7 (permalink)  
Old June 28th, 2004, 09:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #8 (permalink)  
Old June 28th, 2004, 10:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #9 (permalink)  
Old June 28th, 2004, 03:13 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #10 (permalink)  
Old June 29th, 2004, 04:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating database application ruslaim VB Databases Basics 3 November 21st, 2007 10:25 PM
problem: Creating the Example Database dcr BOOK: Beginning SQL 1 October 11th, 2007 07:56 AM
creating a database kcrist84 VB Databases Basics 3 July 20th, 2007 03:35 PM
Creating New Database everest SQL Server 2005 2 July 10th, 2007 01:32 PM
Problem creating drinks control database Odeh Naber Access VBA 5 August 5th, 2006 09:33 AM



All times are GMT -4. The time now is 10:05 PM.


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