I was working on some tables in mysql, and out of no where, i got an error (Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.) Then i uninstalled xampp and tried to reinstall it. Then i got the error (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.)
How can i get access again?
Related
After reading multiple questions of users with problems like:
forgot password
installed multiple instances of MySQL
forgot to start MySQL
etc. etc
I started to consider if it is actually possible to conclude from the error page if MySQL is running at all?
Questions with the same type of answers:
mysql said: Cannot connect: invalid settings. xampp
phpMyAdmin - can't connect - invalid setings - ever since I added a root password - locked out
MySQL Says: Cannot connect: invalid settings
But does the error page actually say this is a mysql server response or it couldn't connect (server isn't running for instance)
Take the following code:
<?php
//Step1
$db = mysqli_connect('localhost','username','password','database_name')
or die('Error connecting to MySQL server.');
?>
If one of the inputs is incorrect you will get the error:
Error connecting to MySQL server.
This could be modified into a nice looking error message (as the image above).
So does the error actually prove that MySQL is running or not?
I found a video of a walkthrough on how to fix this error. In the video you can see the servers are running. I was pretty curious about this whole issue.
Link to Youtube:
https://www.youtube.com/watch?v=8fK_DYvosA8
I'm assuming if that's how it worked for the video, that's how it works in general. I'm working off the idea that something can't give you an error message unless it's running.
Sort of. phpMyAdmin generally returns the error message that it gets from MySQL, so for instance if the isn't a MySQL daemon listening on on the TCP/IP protocol, phpMyAdmin shows:
#2003 - Can't connect to MySQL server on '127.0.0.1' (111) — The server is not responding.
For an incorrect username or password, the error message is:
#1045 - Access denied for user 'root'#'localhost' (using password: YES)
"Invalid settings" usually means you have conflicting directives or incorrect information in one of your configuration statements. Without seeing your config.inc.php it's difficult to guess what's wrong here, but this also can mean something went wrong between the PHP library itself and MySQL.
The rejected connection message you posted can also have several causes.
Basically, to directly answer your question, you often can tell based on the error message returned by MySQL or the PHP library (which is the message phpMyAdmin shows). "Can't connect" means phpMyAdmin couldn't get any response from the MySQL daemon, which could have several causes but most often means MySQL isn't running. Most of the other error messages mean it's running but there was a problem connecting. Generally the error message contains some information about why.
I have a VPS with Windows 2008 R2 with IIS web server, MySQL database server. I have hosted around 100 of websites on this server. One of the hosted website is throwing following error message:
" mysql_connect() [function.mysql-connect]: Host 'MYSERVER' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' in C:\Domains\mydomain.com\wwwroot\include\config.php on line 21
Could not be connect to mysql"
This website hosted around 3 years ago. I have not made any changes in the code. But, all of a sudden, website has started throwing error message. After that, I have searched error logs and found following details:
ERROR: 1064 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 'MYSERVER#123'') WHERE User=''root''' at line 1
I have restarted service as well as rebooted server. But, it has not resolved MySQL error.
I was able to re-produce this error on my test server. You should check following:
→ You will have to make sure that the user you have added in your connection string is able to login to mysql server with the password you have entered in connection string. So, make sure that the username and password is correct.
→ Make sure that you have entered correct servername for mysql. If you are using local mysql (installed in same server), you should use 'localhost' in connection string. If you are using remote mysql server, make sure that you have entered it in connection string properly and that user must have remote access.
I got stuck in using ejabberd and JSXC after installing with default configuration and move from Mnesia to MySQL, I could not login to admin site anymore. I checked log as below :
2015-08-06 15:50:32.972 [error] <0.3196.0>#ejabberd_auth:is_user_exists:313 The authentication module ejabberd_auth_odbc returned an error
when checking user <<"ejabberd">> in server <<"10.30.173.89">>
Error message: <<"Unknown Host">>
By the way, could you please help me to create MUC (multi-user chat), I don't know how to config it in JSXC and ejabberd.
This is an error in your configuration. "Unknown Host" error for the SQL query means that ejabberd could not find any MySQL database configured for that domain.
You need to check and fix your ejabberd configuration file.
I also have same question in same scenario.
I can add a new user from command line and also view it in my MySQL DB
./ejabberdctl register test2 localhost test2
But getting unknown host error when the user is trying to connect from client.
This question may be a duplicate. I searched similar question, but the solutions of those problems did not help me fix the problem.
When I open mysql cmd line It asks me for password. Anyhow i did not set password to the server during configuration. So I just hit ENTER when it asks for password(it works on my Classmates' PCs), after I do that, an error message is displayed: error 2003(HY000) Can't connect to MySQL server on 'localhost' (10061).
So I thought there must be some problem with the windows service for mysql. I found out that the service was not running, so I tried to manually start the service, When I did so I got an error message: windows could not start the mysql service on local computer Error:193: 0xc1.
What Can I do...
Check the windows service for mysql running for not.If not running start it from services as administrator.
You can resolve this in a better way by starting service {mysql56} from command line as Administrator
net start mysql56
Second method
Check path to execute also check in registry also From Run type
services.msc
Select mysql56(mysqlxx) right click and check
properties and note down path to execute
From Run type regedit and
navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Select the mysql service (mysqlxx) and check its ImagePath value
data as same as path to execute
If it is not change it
I'm running a local copy of WordPress on XAMPP/WinXP for development, but would like to maintain a connection to the remote database. I keep getting "Error establishing database connection" no matter what I try.
On the same PC, I can connect to the remote mySQL DB using any number of mySQL clients, and on the mySQL side, the both the user and the database are set to accept incoming requests from any wildcard domain. I can also easily ping the remote database server from my PC (though I don't know how to do it from WITHIN XAMPP).
Is XAMPP its own little universe that can't reach through to the outside world? Or is there something I'm clearly overlooking that's not letting me connect?
Errors
Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:553) in C:\xampp\htdocs\dbtest.php on line 5
Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in C:\xampp\htdocs\dbtest.php on line 5
Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
Edit
Thanks to #Michael for suggesting I just create a simple connection script so I can get better insight into the actual error that's being thrown. This revealed that it had to do with the old_password setting in mySQL. See my Answer below for a full description of how to resolve this issue.
Here's the test script I put inside my xampp\htdocs folder and tested out:
<?php
$mysqli = new mysqli('my.server.address', 'user_name', 'password', 'database_name');
if ($mysqli->connect_error){
die ("Connect error: " . $mysqli->connect_error );
}
I'm not really clear on why this became an issue on my XAMPP installation, since I'm also running PHP 5.3.x on the server's local box and wasn't experiencing those issues there. However, it has to do with my mySQL server running in "old password" encryption mode. Newer versions of PHP won't allow those kinds of connections, so you need to update your mySQL server to use the newer password encryption. Here are the steps, assuming you have control over the mySQL server. If you don't, that falls out of the scope of my knowledge.
locate the configuration file for the mysql server called my.cnf. I found mine at /etc/my.cnf. You can edit it with sudo nano /etc/my.cnf
Look for a line that says old_passwords=1 and change that to old_passwords=0. You have now told the server that the next time it is run, and it is asked to encrypt a password using the PASSWORD() command, it use the new 41-character encryption rather than the 16-character 'old' style encryption
Now you have to restart your mysql server / service. YMMV, but on Fedora that was easily done with sudo service mysqld restart. Check your OS' instructions for restarting the mysql daemon or service
Now we have to actually edit our user table within mysql. So open up an interactive shell to mysql (on the server you can type mysql -uYourRootUsername -pYourRootPassword)
Change to the mysql database. This is the database that holds all the good stuff for server operation and authentication. You must have root access to work with this database. If you get an 'access denied' you're SOL. Sorry. use mysql; will switch to that database
Now we want to update the user that was giving you grief. Ultimately you'll probably want to update all your users, but for now, we're just focusing on the user that threw the error. update user set Password=password('YOUR_PASSWORD') where User='YOUR_USERNAME';
Now you just need to tell mysql to use the new password for authentication when that user attempts to connect. flush privileges;.
You should be good to go!