|
|
How to use MySQL...
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Ugh. It frustrates me. I have mySQL all nice and installed (I think) but I don't know how to use it. Any reccomendations for a beginner's site?
|
|
|
|
|
|
|
|
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Hm... Thanks for the site, but now I am getting some errors. When I type 'CREATE DATABSE jokes;' I get "ERROR 1044: Access denied for user '@localhost' to database 'jokes'"
I've tried a couple of other things like opening mysql with "mysql -h localhost root -p" then entering my password. I get the error "ERROR 1045: Access denied for user: 'my_username@localhost' (Using password: YES)"
...and then it doesn't open mysql. Is there something important I'm missing?
|
|
|
|
|
|
|
|
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
OS X runs the mysql daemon as the user 'mysql' and not as your username. assuming you have the path to mysql set in your $PATH, type this in terminal (obviously, you don't type the comments):
# set the admin password to "new_password" <- change this to whatever you want
mysqladmin -u root password new_password
# login to the mysql shell
mysql -h localhost -u root -p
# give the user the right permissions
GRANT ALL PRIVILEGES ON *.* TO mysql@localhost IDENTIFIED BY 'new_password';
that should do the trick and let you create the example from the site.
if you need any more help, ask Simon, or come back in about 4-5 hours. i've got to sleep sometime
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by Jaey:
Hm... Thanks for the site, but now I am getting some errors. When I type 'CREATE DATABSE jokes;' I get "ERROR 1044: Access denied for user '@localhost' to database 'jokes'"
I've tried a couple of other things like opening mysql with "mysql -h localhost root -p" then entering my password. I get the error "ERROR 1045: Access denied for user: 'my_username@localhost' (Using password: YES)"
...and then it doesn't open mysql. Is there something important I'm missing?
Ooops! Watch that whitespace!
it should be 'mysql -hlocalhost -uroot -p' - Unix/Linux etc is usually pretty picky about whitespace around directives.
In most instances, though, localhost is assumed so unless your MySQL server is on a physically different IP address then you can shorten that to:
'mysql -uroot -p'
As a matter of habit, I'd create an admin user instead of using the root account - just more of a good habit whilst your learning. Being root is a surefire way to really mess something up late at night or to allow security holes.
Get to bed Philzilla. I know you're still reading this.
|
Computer thez nohhh...
|
|
|
|
|
|
|
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
Originally posted by Simon Mundy:
Get to bed Philzilla. I know you're still reading this.
but... i... eh, i'm going.
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Sweet, thanks for the help guys.
Originally posted by Simon Mundy:
As a matter of habit, I'd create an admin user instead of using the root account - just more of a good habit whilst your learning. Being root is a surefire way to really mess something up late at night or to allow security holes.
Yeah... that's probably a good idea. Erm, how do I do that, though?
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by Jaey:
Sweet, thanks for the help guys.
Yeah... that's probably a good idea. Erm, how do I do that, though?
Okay... let's call your user 'admin' with the password 'crappassword'
Connect to the MySQL command line with:-
'mysql -uroot -p'
Then type the command
GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , FILE , INDEX , ALTER , CREATE TEMPORARY TABLES ON *.* TO "admin"@ "localhost" IDENTIFIED BY "crappassword" ;
This will give you unrestricted access to all databases and tables, but you can't do anything to the mysql daemon itself (i.e. shut it down, reset it, etc.) whilst you are logged in as that user.
So while this user is safe(r), remember that if someone found out your user/password they could still destroy data or alter the structure of your databases.
Enjoy!
|
Computer thez nohhh...
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Thanks for all the help.
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Mar 2003
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Jul 2003
Location: San Jose
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
I'm pretty fond of SQLGrinder and use it in my work daily. It supports other databases as well (MySQL, PostgreSQL, Oracle, and Sybase are the ones I use, but it supports numerous others as well).
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|