PHP Warning: mysql_connect(): Access denied for user 'www'@'localhost'
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
PHP Warning: mysql_connect(): Access denied for user 'www'@'localhost'
Hello All,
I am having serious problem with this error. We had old SME server, needed to move to new server., old server also has intranet site for local application, in php and mysql. So I used the affa , outline in http://wiki.contribs.org/Moving_SME_to_new_Hardware . After rising the backup server to production server, when I go to intranet, I am getting mysql_connect() error. I dont have password for mysql, I can log in to mysql without password from command line. the strange thing was , I backup mysql databases and restored to one of the test machine and copied all the folders and files from /home/e-smith/files/ibays , it worked, not sure what is happening here. Please help.
well fundametnally it's a pretty simple error. there is somethign wrong with the credentials you're using, either the app is using them wrong, or they are not correct / don't exist in the database. So if you're restored the DB, look in the dump for the appropriate GRANT entries and such like.
Code:
mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON <database>.* TO '<user>'@'localhost'
-> WITH GRANT OPTION;
Thanks man,
I am trying to create the user
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; exactly as it is , and getting ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'' at line 1 . What I am getting when I go to local site is, "Warning: your browser was not able to connect to the database-server. Please try to reload the page by clicking on reload. " . The thing I dont understand is exactly the same dbs and php code , supposed to be identical copy using affa as well. I am pulling my hair out..
I just set the root user with password, and set it in the php files variable. no more of connection error in log, but not displaying anything either. So checking the log at the moment,
It seemed to be wokring now, I am suprised that same code same databases and same users not working. Thank you very much your help man, that saved my life
This script shows the current grants/users on a db; you'll need the mysql root user's passwd
Code:
mysql -u root -p${1} --batch --skip-column-names -e "SELECT user, host FROM user" mysql | sed 's,\t,"@",g;s,^,show grants for ",g;s,$,";,g;' | mysql -u root -p${1} --batch --skip-column-names | sed 's,$,;,g'
MySql changed the password hashing somewhere along the line (version 4.1 or so). So old authentications no longer work on newer versions; I think it is possible to configure MySql to use the old hashing but 'm not 100% sure.
That's a possible cause. You can check the passwords in the MySql user database for their length; and the new 'format' password starts with '*' while the old ones don't.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.