Forum Moderators: coopster

Message Too Old, No Replies

Creating user account - MySQL

         

woldie

3:30 pm on Jul 21, 2004 (gmt 0)

10+ Year Member



Hi,

I've installed MySQL on a server, and have been trawling through mysql.com docs on how to create a new user, and I've come to brick wall, and need some advice on this.

Essentially what I need to achieve is to type in the following command mysql -u username -p password, but how do I go about doing that? I've tried using mysqladmin but I get the following error:

mysqladmin: unable to change password; error 'access is denied for user: '@localhost' to database 'mysql'.

Any ideas?

Thanks

StupidScript

4:42 pm on Jul 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mysql -u username -ppassword

Will allow access to mysql from any valid user on your machine, that is, not a mysql user specifically, but any valid user.

Create a new regular or root user on your computer, first, then use the above syntax to start mysql.

To allow any user to have full access to a database that they did not create, execute the following as either the owner/creator of the database or as root:

grant select,insert,update,delete,create,drop on databasename.* to username@localhost identified by 'userpwd';

Then you can use stuff like:

mysql_connect('localhost','username','userpwd');
mysql_select_db('databasename');