Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL Permissions Error - Access Denied (2)

about php

6:20 pm on Mar 8, 2007 (gmt 0)

5+ Year Member


I just want to ask about this error report

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mysql_user'@'localhost' (using password: YES) in W:\www\um\database2.php on line 2
Could not connect: Access denied for user 'mysql_user'@'localhost' (using password: YES)

How to overcome this error?

And what i suppose to do using phpmyadmin?

I really don't know what is the purpose of phpmyadmin?

and i just copy this script and save as database.php then i go to localhost/um/database.php but there is a warning.

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());

$sql = 'CREATE DATABASE my_db';
if (mysql_query($sql, $link)) {
echo "Database my_db created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";

do i need to change it?

please help me

6:30 pm on Mar 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

as far as i know it says that your password and databse name settings are not correct

just check following

1) you are using right database name
2) you are using right user name for that database
3) you are using right password

this will work

thanks and bye

7:24 pm on Mar 8, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

You may need to use your control panel to do the actual database creation - your 'mysql_user' may not have permission to create databases. If you're doing this on your own computer, then you can use mysql's command line utility to check/set that user's permissions.

phpMyAdmin is a very handy utility for manipulating database table structure and content. With it you can create/modify/delete tables and insert/modify/delete data in the tables. You can use it to create backups (export) or restore from backups (import). If the user under which you're running it can create databases, then you can also do that with it, and you can add users to the databases.

7:40 pm on Mar 8, 2007 (gmt 0)

5+ Year Member


now i can create database but i don't know where i will insert all my data, did i have to use phpmyadmin or command prompt for mysql?

hopefully u can m help me again.

7:53 pm on Mar 8, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

If you've got it set up so that the user you want to use can access the database, the easier way to add data is through script. phpMyAdmin is good for adding/modifying small amounts of data and can import a list of sql insert statements if you've got one, but other than that it would be too cumbersome. There's no way I'd use mysql command line for inserting data.
There's tons of great information around this forum to learn how to use scripts to manipulate your database data. This one is in the library:
[webmasterworld.com ]