I am developing php site using xampp and I am having trouble accessing my MySql database.
I get the following error:
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'guest'#'localhost' (using password: YES) in C:\xampp\htdocs\Clothing\index.php on line 24
Here is the php code to connect to the database:
$conn = mysqli_connect('localhost', 'guest', 'Change01&', 'clothing')
All the credentials such as username and password are definitely correct, I have reset the password in phpMyAdmin about a thousand times and I still get the error. I have also made sure the guest user has all permissions set. What else could be the problem here ? It might be worth mentioning that I have changed the default ports for Apache but not for MySql.
Related
I changed the password for the "root" user in phpmyadmin, now i get an error:
MySQL said: Documentation
Cannot connect: invalid settings.
mysqli::real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
Tried editing the config.inc.php it says i don't have permission to edit.
Tried doing the terminal through xampp and still no luck. Any help?
I installed xammp, apache loads fine, but I ran into an issue where I was getting access denied when trying to open phpmyadmin database, so after a little search, google suggested going to phpmyadmin setting and locate my config.inc file in where the file config has a line that sets $cfg['Servers'][$i]['auth_type'] was set to config like this $cfg['Servers'][$i]['auth_type'] = 'config' on phpmyadmin settings, now after some research I found that people who had the same similar issue changed theirs to cookie like this $cfg['Servers'][$i]['auth_type'] = 'cookie', which I did, now I got the next issue which is a login page, when trying to login I get four errors.
ERROR - 1 Can not log in to the MySQL server
ERROR 2 - mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'#'localhost' (using password: NO)
ERROR 3 - Connection for controluser as defined in your configuration failed.
ERROR 4 - mysqli_real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: NO)
I then did a little google search and people said to remove the password, set
$cfg['Servers'][$i]['AllowNoPassword'] to true some thing like this $cfg['Servers'][$i]['AllowNoPassword'] = 'true',
have done that but nothing happened, the login page still appears, is there a way to eliminate this, its driving me nuts over here.
THANKS IN ADVANCE...
You're getting two different errors here; phpMyAdmin can be configured to use an optional user (called the 'controluser', 'pma' in your case) for enhanced features. If you haven't created the user, you'll see an error message, but you can edit your config.inc.php to remove or comment out the lines referencing 'controluser', 'controlpass', and 'pmadb' to disable these advanced features. However, that doesn't seem to be your problem here.
The second error message, about the root user not being able to connect, indicates that there's a problem communicating with or authenticating to the MySQL server. You should try connecting from the command line client to see if you're able to connect as the root#localhost user (which is MySQL shorthand for using the socket connection type rather than TCP/IP networking). You can probably test this with mysql -u root -h localhost.
If the AllowNoPassword variable were causing the problem, you should instead see the error message
Login without a password is forbidden by configuration (see AllowNoPassword)
I have setup a MySQL database and I am trying to connect to it from another website.
I get this error when I try to connect to it:
Connection failed: Access denied for user 'myUsername'#'localhost' (using password: YES)
It works fine when I do it in the same website where the database is hosted.
I tried this SQL query:
GRANT SELECT, DELETE, UPDATE ON database.myDatabaseName TO 'myUsername'#'localhost' IDENTIFIED BY 'myPassword';
But I got this error:
#1142 - SELECT,UPDATE,DE command denied to user 'Steve'#'localhost' for table 'myDatabaseName'
I went to the MySQL management in the built-in control panel where I modified permissions of Steve and added the Grant permission, however I still get the same #1142 error.
How can I fix this?
Thanks in advance.
Access denied for user 'myUsername'#'localhost' (using password: YES)
That's where the error is. It says you are attempting to connect to localhost with the username myUsername and a supplied password. However, usually on localhost, especially on windows systems, the user is Root and the password is not set, just an empty string. Check your username on your localhost and your password.
I'm trying so hard to make connection to mysql, and so far I end up with this error :
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'dev'#'localhost' (using password: YES) in D:\Programs\Xamp\htdocs\series\dynamic\AtomCMS\setup.php on line 5
Could not connect because: Access denied for user 'dev'#'localhost' (using password: YES)
I've just started developing a new web based system and here is the code I used to make connection to the database. Any help is appreciated.
$dbc = mysqli_connect('localhost','dev','123','pouya')OR die('Could not connect because: '.mysqli_connect_error());
Sincerely,
In case you are using XAMPP then open the phpmyadmin interface using [localhost/phpmyadmin]
1) On selecting the database you want to access.You get an option on right having a tab called privileges.
2) You need to check whether the user exist.If not Create a user dev.If the user exist try to recreate as you may be using a wrong password.
You need to make sure that the dev user exists, and that they are granted access rights to pouya.
I have a PHP file called footer10.php that worked just fine in shared hosting. I moved it to a virtual server and it no longer works.
I get these errors when I pull the file up in a browser:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'#'localhost' (using password: NO) in /var/www/.../...com/httpdocs/.../footer10.php on line 23
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /var/www/.../...com/httpdocs/.../footer10.php on line 23
Access denied for user 'apache'#'localhost' (using password: NO)
This is on line 23 of the file:
$presult = mysql_query("SELECT COUNT(*) FROM submission") or die(mysql_error());
Any idea what I need to do to make the file work on the virtual server?
Thanks in advance,
John
The error message means that PHP could not connect to the MySQL database.
If you're establishing the connection on your own using mysql_connect you should make sure that host, user and password are correct (according to the error message no password was specified)
The user name and the empty password makes me think you've relied on the mysql.default_* settings on your old server. You can specify a default server in your php.ini, refer to the manual for this. The connection will then be opened automatically by php.
So what you have to do is to find out correct credentials for your MySQL server. Then you either establish a connection using mysql_connect/mysql_pconnect or add it to the php.ini.
Access denied for user 'apache'#'localhost' (using password: NO) , what does this line mean ?
It means you need to update you're mysql connection settings with the correct ones ( username , password and host ) by this i mean you're mysql connection settings on the new server are different than the ones on the old server . Then make shure to move the database from one server to another .