homepage Welcome to WebmasterWorld Guest from 54.161.166.171
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
MySQL Permissions Error - Access Denied (2)
about php
puteri nur85




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

hello,

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.

<?php
$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
thanks,

 

benevolent001




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

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

cameraman




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

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.

puteri nur85




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

thanks

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.

cameraman




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

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 ]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved