Error Message Below Access Denied For User
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Connect failed: Access denied for user 'root'@'localhost' (using password: YES)” from php function up vote 33 down vote favorite 13 I wrote some function used by a php webpage, in order to interact with a mysql database. When I test them on my server I get this error: "Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" I am able to use them on my pc (using XAMPP) and I can navigate through the tables of the database using the command line in the server. Instead, the webpage fails to connect. I've checked the password but with no results, it's correct (otherwise I could not log in to mysql from the command line). The call of the function is the following: $conn = new mysqli("localhost", "root", "password", "shop"); Have I to set something in my server? Thanks Edit: PHP version 5.3.3-7+squeeze1 mysql version: 5.1.49-3 both on debian php mysql access-denied share|improve this question edited Jun 22 '11 at 23:21 asked Jun 22 '11 at 18:49 fbrundu 1,97194476 migrated from superuser.com Jun 22 '11 at 20:11 This question came from our site for computer enthusiasts and power users. 1 What version of PHP are you running? What version of MySQL? It sounds similar to bitshop.com/Blogs/tabid/95/EntryId/67/… –Jack Murdoch Jun 22 '11 at 20:16 add a comment| 8 Answers 8 active oldest votes up vote 48 down vote accepted I solved in this way: I logged in with root username mysql -u root -p -h localhost I created a new user with CREATE USER 'francesco'@'localhost' IDENTIFIED BY 'some_pass'; then I created the database CREATE DATABASE shop; I granted privileges for new user for this database GRANT ALL PRIVILEGES ON shop.* TO 'francesco'@'localhost'; Then I logged out root and logged in new user quit; mysql -u francesco -p -h localhost I rebuilt my database using a script source shop.sql; And that's it.. Now from php works without problems with the call $conn = new mysqli("localhost", "francesco", "some_pass", "shop"); Thanks to all for your time :) share|improve this answer answered Jun 23 '11 at 12:30 fbrundu 1,97
active in CP, but "Not Found"?000WebHost Services Concrete5: Unable to connect to databaseContent Managament Systems Blocked from accessing my http://stackoverflow.com/questions/6445917/connect-failed-access-denied-for-user-rootlocalhost-using-password-yes websiteCustomer Assistance Database connection not working and php my admin not working000WebHost Services How do I get my 5 free email accounts?Customer Assistance Web Mail https://www.000webhost.com/forum/content-managament-systems/8823-phpbb3-installation-problems.html doesn't workWebsite Building My website is appearing on two domains. PLEASE HELP!Web Programming How does website stats work?Customer Assistance More… Recent My First Website CreationSite Showcase How to create a CNAME?Customer Assistance Update DNS ERROR000WebHost Services Webstorm to 000webhost? Embedding site into an existing siteCustomer Assistance MySQL Database connection errorCustomer Assistance website builder Mgallc.site90.net website is down.... but works fine using a VPN000WebHost Services (Errcode: 30) (PLEASE HELP) Embedding website More… Search this site Google
11 months ago 21 Edit title History Permalink Summarize Hide topic Sriniu (talkcontribs) Hi All, I have installed the mediawiki in Redhat linux environment and all the installation with configuration are went fine, but in the https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Can't_contact_the_database_server:_Access_denied_for_user_'wikiuser'@'localhost'_(using_password:_NO)_(localhost))/reply end when I tried to access the mediawike i getting below error message: Can't contact the database server: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost)) I am not sure what was the https://www.ostraining.com/blog/coding/error-1045-phpmyadmin/ problem i was able to login as wikiuser at wikidb (database). Can someone help me what will be the issue and where I am wrong. thanks in advance. best Regards Reply 18:24, 29 error message October 2012 3 years ago Permalink Hide Ciencia Al Poder (talkcontribs) The error message states that you're trying to connect to the database in localhost using the 'wikiuser' user account but without specifying a password. Be sure you specify a valid password for connecting to the database (configured in LocalSettings.php). Reply 10:18, 30 October 2012 3 years ago Permalink Hide Sriniu (talkcontribs) thanks for your reply. yes error message below i have give wikiuser password only. i tried to login in mysql with wikiuser and its password and it is working fine. but not sure i am getting access denied error for wikiuser. Reply 20:43, 30 October 2012 3 years ago Permalink Hide Ciencia Al Poder (talkcontribs) Please, be sure that you've configured $wgDBpassword. It's not clear from your reply that you've done that. Reply 19:57, 31 October 2012 3 years ago Permalink Hide 160.62.13.190 (talkcontribs) Database settings $wgDBtype = "mysql"; $wgDBserver = "localhost"; $wgDBname = "wikidb"; $wgDBuser = "wikiuser"; $wgDBpassword = "wikiuser"; just want to recheck with you, i have copied LocalSettings.php file under /var/www/devwiki/ path, is it ok? because all the mediawiki folder and files are under devwiki. Reply 10:08, 2 November 2012 3 years ago Permalink Hide Ciencia Al Poder (talkcontribs) Those settings seem okay. Maybe the problem is the user. Note that on mysql the user is also associated to a host (localhost in this case). Try resetting the password: http://dev.mysql.com/doc/refman/5.0/en/assigning-passwords.html You should do that for 'wikiuser'@'localhost', 'wikiuser'@'%' and 'wikiuser'@'yourhost', where "yourhost" is the hostname of the database. Reply 10:20, 2 November 2012 3 years ago Permalink Hide 31.18.152.25 (talkcontribs) Hi, I also get: (Can't co
could possibly encounter the error: #1045 Access Denied for user 'root'@'localhost' (using password: YES).If root@localhost wasn't granted the necessary rights to access the database or you provided the wrong password, you will then encounter this error.Following this tutorial will help guide you on bypassing this error, for any local host server using phpMyAdmin.If you get an Error #1045 in phpMyAdmin it will look like the image below:Step 1: Open your MySQL console. Using WAMP, left click your WAMP icon located at the bottom right of your desktop and click on MySQL Console. Guide to accessing MySQL using XAMPP Guide to accessing MySQL using MAMP. Step 2: Enter the Provided Command LinesIf you have a password, you can ignore this part. Type in: use mysql; Press Enter. Set your MySQL Password: UPDATE mysql.user SET Password=PASSWORD("EnterYourPasswordHere") WHERE User="root"; Replace "EnterYourPasswordHere" with your new chosen password. Press Enter. Flush the privileges: FLUSH PRIVILEGES; Exit by typing: Exit Press Enter. Step 3: Open and edit your config.inc.php file located in your local server files Using a text editor, such as Notepad++, open your config.inc.php file. Go to My Computer > C Drive > (Your Local Server Folder, WAMP/MAMP/XAMPP) > APPS > PHPMYADMIN > config.inc.php Find this line of code: $cfg['Servers'][$i]['password'] = ''; // MySQL password Change 'password' to the new chosen password you created from Step 2. Click Save. Step 4: Access phpMyAdmin You can access phpMyAdmin by going to http://localhost/phpMyAdmin/. Congratulations! You are now able to access your databases. View the discussion thread. blog comments powered by DISQUS back to top Blog Categories WordPress TutorialsDrupal TutorialsJoomla TutorialsCoding TutorialsOSTraining NewsWeb Design TutorialsBlog LicenseAll our blog posts are published under the Creative CommonsAttribution-NonCommercial license: You can re-use these tutorials. You can