 |
 |
How do I create a new MySQL data base????
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
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
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
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;
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
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
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
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/
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jul 2003
Location: NC, USA
Status:
Offline
|
|
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
|
|
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')
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2000
Location: Utah, USA
Status:
Offline
|
|
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
|
|
|
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|