Im a bit confused on how to set up users and connect to the mysql server using this newly made user. According to a book Im learning from, creating a user involves the following lines:
GRANT [privileges]
ON [database_name]
TO [user_name]
IDENTIFIED BY '[password]';
Im running mysql 3.23.49a on a TurboLinux 6.5 server. After starting up the mysql server I enter the following:
GRANT all
ON database1.*
TO user1
IDENTIFIED BY 'password1';
Now when I have the following line in a php file:
/* LINE 7 */
mysql_connect("localhost", "user1", "password1"
/* LINE 8 */
mysql_select_db("database1"
I get the following displayed in my browser:
Warning: Access denied for user: 'user1@localhost' (Using password: YES) in /home/user1/public_html/script.php on line 7
Warning: MySQL Connection Failed: Access denied for user: 'user1@localhost' (Using password: YES) in /home/user1/public_html/script.php on line 7
couldnt connect to mysql
Why does the connection fail even after I create a user through mysql? Does 'user1' have to exist as a user on my Linux server? or can I create 'user1' as as username on mysql even if this username doesnt exist on my Linux server?
Im not able to get the grasp of how to create usernames and using these to connect to the mysql server.
Any help is appreciated! Thanks!
--REI
GRANT [privileges]
ON [database_name]
TO [user_name]
IDENTIFIED BY '[password]';
Im running mysql 3.23.49a on a TurboLinux 6.5 server. After starting up the mysql server I enter the following:
GRANT all
ON database1.*
TO user1
IDENTIFIED BY 'password1';
Now when I have the following line in a php file:
/* LINE 7 */
mysql_connect("localhost", "user1", "password1"
/* LINE 8 */
mysql_select_db("database1"
I get the following displayed in my browser:
Warning: Access denied for user: 'user1@localhost' (Using password: YES) in /home/user1/public_html/script.php on line 7
Warning: MySQL Connection Failed: Access denied for user: 'user1@localhost' (Using password: YES) in /home/user1/public_html/script.php on line 7
couldnt connect to mysql
Why does the connection fail even after I create a user through mysql? Does 'user1' have to exist as a user on my Linux server? or can I create 'user1' as as username on mysql even if this username doesnt exist on my Linux server?
Im not able to get the grasp of how to create usernames and using these to connect to the mysql server.
Any help is appreciated! Thanks!
--REI