Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-18-2011, 06:10 PM   #1
LQ Newbie
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
MySQL - phpmyadmin: Access denied for user 'test'@'localhost'

Hi everyone,this is my first post. I need some help with MySQL because I am getting the error "Access denied for user 'test'@'localhost'". I have set up a database and it contains two tables. I have some php code which inserts info into one of the tables.
My problem is that I had created a user 'test' with no password. I have two .php files, one inserts data into the first table and the second to the other. Both of these use the same user and password.
The first one has no trouble inserting into the database and I can see that it inserts, but when I run the second php file it gives me the above error. What's wrong? I've looked all over for the answers but nothing works. Why does it work for one and not the other?

This is the code where it's stalling:
$connection = mysql_connect ("localhost", $username, $password);

where my username and password is the same for both files.

username = test, password = ""
Old 03-18-2011, 09:09 PM   #2
LQ Newbie
Registered: Jan 2011
Distribution: Arch Linux
Posts: 16

Rep: Reputation: 6
Are you sure that it's not connecting at all? Assuming that both files connect with the same user information, the only way I can imagine you would have trouble is by having privileges on one table but not another.

If you haven't already, try the following.
GRANT ALL ON database_name.* TO 'test'@'localhost';


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql --- Access denied for user 'test'@'localhost' permalac Linux - Server 15 03-05-2013 08:51 PM
MYSQL: Access denied for user 'root'@'localhost' (using password: NO) jun_tuko Linux - Software 3 03-05-2013 06:37 AM
Mysql error 1045: Access denied for user 'root'@'localhost' (using password: YES) visitashu Linux - Server 15 11-10-2010 11:05 PM
HELP FOR#1045 - Access denied for user 'phpmyadmin'@'localhost' (using password: YES) amritpalpathak Linux - Software 1 03-20-2010 05:35 PM
Sarge mysql-server Access denied for user: root@localhost infinity432 Linux - Software 2 05-18-2005 11:42 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration