Forum Moderators: coopster
MySQL currently has a two default databases,
test and mysql. The former is fairly obvious, a test database that you can play around in. The latter is how mysql implements security -- they use their own database. Log in as root and you can look around -- Resources you may want to review:
Windows Post-installation Procedures [mysql.com]
GRANT and REVOKE Syntax [mysql.com]
If you already setup root right, login to mysql and create the database you want.
create database 'testmebase';
now you have the database, you need to give your user account permision to work with it. It still doesn't have any tables or anything like that, it is just a base. So now you want to run a query like
grant all on testmebase.* to mehere@localhost identified by "myfavpasswd";
That is if you aren't worried about security right now. During development security isn't that much of an issue; things get tighten later.
Anyway, you should be able to log off as root now, and log in as your user, and use that database to create tables, drop tables and basically run-amook.
Now remember that login accounts for your MySQL database and your OS are different, and don't intermix. So, you don't have to be signed in as root, to log onto MySQL as root, you just have to have the password. This is why it's always a good idea to use the @localhost part when giving permissions to a user. What that means is they have to be on that computer, not logging in remotly. Any time you create an account to use with PHP, always use @localhost.
Also, if you have two databases, on the same server, and you use one password for the first, then change the password for the second, you will find that you can't log into the first one. You only have one MySQL account per server, no matter how many databases you have there. That is not to say that a user on the OS can't have 100 MySQL accounts on the same serer (and we frequently do).
After you set the permissions, you may have to use mysqladmin to refresh the tables and get your password validated.
mysqladmin -u root -p flush-privileges
Now if you haven't setup your root password yet, then go to this page, read it over and follow the directions.
www.ejbsolutions.com/products/obox/community/ch11.html
or better
[mysql.com...]
and
[mysql.com...]
good luck
Glenn Hefley
[edited by: jatar_k at 5:31 pm (utc) on Feb. 23, 2004]
[edit reason] delinked [/edit]