Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How do I create a new MySQL data base????

How do I create a new MySQL data base????
Thread Tools
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 06:55 PM
 
Ok, I have logged into MySQL and I get the mysql prompt.

mysql>

The I type:

create database dvds;

I get this error:

Access denied for user: '@localhost' to database 'dvds'

What do I need to do in order to create a new database?

Thanks!
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 07:30 PM
 
This assumes you installed MySQL using some kind of package or followed a default binary installtion.

The error impliess you are not logged on to MySQL as a privileged user. When you installed MySQL, there were two users created" 'anonymous' and 'root'. These are MySQL users and have nothing to do with the OS users.

Unless you specifed the root username and password while logging in, you will be logged in as anonymous. This user only as access to the 'test' database which was created automatically during the install.

The 'root' user is initially created with a blank password. Depending on the package you used for installation, it may have prompted you to change it.

To log in as root, execute this on the command line:

mysql -uroot
or
mysql -uroot -pyour_password

...depending on whether you set up a password
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 07:47 PM
 
Originally posted by queritor:
This assumes you installed MySQL using some kind of package or followed a default binary installtion.

The error impliess you are not logged on to MySQL as a privileged user. When you installed MySQL, there were two users created" 'anonymous' and 'root'. These are MySQL users and have nothing to do with the OS users.

Unless you specifed the root username and password while logging in, you will be logged in as anonymous. This user only as access to the 'test' database which was created automatically during the install.

The 'root' user is initially created with a blank password. Depending on the package you used for installation, it may have prompted you to change it.

To log in as root, execute this on the command line:

mysql -uroot
or
mysql -uroot -pyour_password

...depending on whether you set up a password
I have not yet set up a "mysql" root user password. How do I do this?
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 07:56 PM
 
Log on to MySQL using:

mysql -uroot

Then execute this command, replacing MY_PASSWORD with whatever password you want:

grant all on *.* to root identified by MY_PASSWORD with grant option;
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 08:00 PM
 
Originally posted by queritor:
Log on to MySQL using:

mysql -uroot

Then execute this command, replacing MY_PASSWORD with whatever password you want:

grant all on *.* to root identified by MY_PASSWORD with grant option;
Ok, I have changed the root password.

Now when I type:

mysql -uroot -pmy_password

all I get is:

->

If I type:

mysql -uroot -pmy_password;

I get this:

You have an error in your SQL syntax.

Any ideas?
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Aug 4, 2003, 09:22 PM
 
try 'mysql -u root -p'

it should ask you for your password, and then you should get the same prompt you got at the beginning, then you will have permissions to add a new database.

alternately, it might make some sense to get a gui for mysql, it will make the whole process much less painless.

I would recommend:
webmin - http://webmin.com - doesn't require anything (web interface)
phpmyadmin - http://phpmyadmin.sf.net - you need php installed on the computer ( web interface)
yoursql - http://www.mludi.net/YourSQL/ - need a mac (mac gui interface)

--will
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 09:35 PM
 
Originally posted by skyman:
Ok, I have changed the root password.

Now when I type:

mysql -uroot -pmy_password

all I get is:

->

If I type:

mysql -uroot -pmy_password;

I get this:

You have an error in your SQL syntax.

Any ideas?
You're supposed to exit mysql before you type that.

Type it from the shell, not the MySQL prompt.
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 09:44 PM
 
Originally posted by queritor:
You're supposed to exit mysql before you type that.

Type it from the shell, not the MySQL prompt.
All I want to do is to be able to create a new data base.

So, lets start all over.

Let's start from point A.

I have installed MySQL.

Now what? If you could please provide step by step instructions that would be great because I have tried everything and I can not create a new data base.

Step 1- Open Terminal
Step 2- ??
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 09:59 PM
 
You were doing it correctly. You just needed to log in as a privileged user. You state you have now created a password for the root user, so at the shell prompt type:

1) mysql -uroot -pMY_PASSWORD
2) create database DB_NAME;

It may be worthwhile reading the documentation at http://www.mysql.com/doc/en/index.html
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:04 PM
 
Originally posted by queritor:
You were doing it correctly. You just needed to log in as a privileged user. You state you have now created a password for the root user, so at the shell prompt type:

1) mysql -uroot -pMY_PASSWORD
2) create database DB_NAME;

It may be worthwhile reading the documentation at http://www.mysql.com/doc/en/index.html
Ok, I open the terminal and I type:

mysql -uroot -pdata123

I then get this error:

Command not found

Now what?
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:11 PM
 
That just means the mysql program is not in your path.

To find out where it is, type:

locate mysql

If this returns nothing, it may mean you have just recently installled MySQL and the 'locate database' has not been rebuilt.

What package did you use to install MySQL?

Some common locations for it are:

/Library/MySQL/bin/
/opt/MySQL/bin/
/usr/local/bin/
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:19 PM
 
Originally posted by queritor:
That just means the mysql program is not in your path.

To find out where it is, type:

locate mysql

If this returns nothing, it may mean you have just recently installled MySQL and the 'locate database' has not been rebuilt.

What package did you use to install MySQL?

Some common locations for it are:

/Library/MySQL/bin/
/opt/MySQL/bin/
/usr/local/bin/
Ok, I type:

locate mysql and I get:

/System/Library/PHP/DB/mysql.php
/usr/share/zsh/4.0.4/functions/_mysql_utils
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:22 PM
 
[QUOTE]Originally posted by queritor:
[B]That just means the mysql program is not in your path.


What package did you use to install MySQL?

http://www.mysql.com/downloads/mysql-4.0.html

Mac OS X Package Installer "Standard"
     
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:31 PM
 
OK.

Prefix the commands I mentioned in my last post with /usr/local/mysql/bin/

ie.

/usr/local/mysql/bin/mysql -uroot -pMY_PASSWORD


You might want to check out the package at http://www.apple.com/downloads/macos...letemysql.html if you ever re-install. They provide a nice integration with the system prefs panel and also provide Apache 2.0 and Tomcat all pre-configured.
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Aug 4, 2003, 10:33 PM
 
it will probably be in
/usr/bin/mysql

so your command would be

/usr/bin/mysql -uroot -p<password>

--will

(if that doesn't work try: 'whereis mysql')
     
skyman  (op)
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status: Offline
Reply With Quote
Aug 4, 2003, 10:42 PM
 
Originally posted by queritor:
OK.

Prefix the commands I mentioned in my last post with /usr/local/mysql/bin/

ie.

/usr/local/mysql/bin/mysql -uroot -pMY_PASSWORD


You might want to check out the package at http://www.apple.com/downloads/macos...letemysql.html if you ever re-install. They provide a nice integration with the system prefs panel and also provide Apache 2.0 and Tomcat all pre-configured.
/usr/local/mysql/bin/mysql -uroot -pMY_PASSWORD

WOOOO HAAAAA!!!! THAT DID IT!!!!

THANK YOU!!!!!!!
     
Forum Regular
Join Date: Apr 2001
Status: Offline
Reply With Quote
Aug 5, 2003, 07:16 AM
 
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:16 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2