MySQL Says: Cannot connect: invalid settings - mysql

We are using XAMPP in a shared environment in our local network. All the projects had the default mysql username and password. Recently I tried to change the user name and password of a project. And now I am not being able to access phpmyadmin. It just displays the following message:
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.
Now no one is able to access the phpmyadmin. How can I solve this?

Error:-Connection for controluser as defined in your configuration failed.
solution:-
because of in your ubuntu system two mysql server running so get confusion solve this problem stop mysql servert first
open terminal
type command:
sudo /etc/init.d/mysql stop
type command:
sudo /opt/lampp/lampp restart
open localhost in browser

you can just solve this by editing the config.inc.php file from the phpmyadmin folder..
This will work fine if you edit the update password with the same username..
Find the line $cfg['Servers'][$i]['password'] =";
Just replace it with
$cfg['Servers'][$i]['password'] = ' ';
Please have a look here for more details

Just add $cfg['Servers'][$i]['host']="127.0.0.1:3307"; if you change port.

There is a bat file 'resetroot.bat' located in the xammp MySQL folder
ie: 'C:\xampp\mysql'
Run the bat file and it will reset the phpadmin passwords. Then start the MySQL service in xammp and try accessing phpmyadmin.
Hope it helps.

In my case it was just because I had forgotten to turn on the 'MySQL' service on the XAMPP control panel. *facepalm*

I am also getting the same error, and finally found the answer with help of first reply of above post. But that is wrong because this error prone due to changed password so all of need to do this to get resolve it.
previous it look like:
" $cfg['Servers'][$i]['password']='';"
after I changed like:
" $cfg['Servers'][$i]['password']='root'; "
The actual reason behind this while installing the XAMMP there is no password but after the that I added password for security. But it did't get updated in config.inc.php so we need to update manually by following above steps.

For my case it seems the mysql server crashed, while it was it running state without any special thing happened. My web app was connected to the db server and was ideal for long time. I was trying to open the phpmyadmin and it started to give issues(same errors mentioned in the question) while connecting to db. After 5 mins I found my db crashed and not at all starting even after trying lot of things.

uninstall the xampp and reinstall it in differnt folder. but before uninstalling it please save the documents of 'htdocs' to the other location and after installing put ur data back to new "htdocs" folder

Remove all lines with $cfg['Servers'] , and keep ONLY the $cfg['Servers'][$i]['host']

Try accessing the phpmyadmin through the "127.0.0.1:8080"

First start the Apache server.
Then click config and open phpMyAdmin(config.inc.php)
Initially you would be having this statement in your config.inc.php
```$cfg['Servers'][$i]['host'] = '12.0.0.0';```
Change the IP address to 'localhost:' i.e.,
$cfg['Servers'][$i]['host'] = 'localhost:';
I did this and the problem solved for me. Hope it helps :)

Step1: Go to xampp/phpMyAdmin/config.inc.php
Step2: Search this: $cfg['Servers'][$i]['host'] = '127.0.0.1';
Step3: Replace with $cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
Here 3307 will be change with your mysql port number, in my case it is 3307. Most of the times it will be 3306.
You can check your mysql port number from here : xampp/mysql/bin/my.ini

find this line-:
$cfg['Servers'][$i]['host'] = 'localhost';
replace it to this -:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3306';
it works for me.in my case I am using port 3306

For my case, I tried to modify Then click config and open with $cfg['Servers'][$i]['host']="127.0.0.1"; then it works.

Related

MySQL 8.0 Command Line Client crashes right after entering the correct password

MySQL 8.0 Command Line Client crashes right after entering the correct password. I have also checked in services and there is no problem there. I'm using windows
This might be because MYSQL service is stopped.
Open search bar in windows and type services
Open the services application and find MYSQL application.
Click on start
Now open sql command line and try entering password
It is because MySQL Server stop, may be you run another application that use the same port. Try to run MySQL Installer Community, and you will find the program that you have to reconfigure (blue text). Try to configure MySQL Server ant click Test Connection.
It's hard to tell with no debug output or error codes, but disabling ssl might do the trick:
mysql --ssl-mode=DISABLED --host=$MYSQL_HOST --user=$MYSQL_USER ....
I had the same issue, was looking through Google to find an answer and came here. Are you sure, that you provided MySQL password? The root cause of my problem was the fact, that I put the MySQL user instead of MySQL password (the root one). Now everything is working fine.
That could mean that the password is failing. Check CapsLock key.
Go to Control Panel and uninstall MySQL Server only, you don't need to unstall the other MySQL files.
As mentioned here, make sure you can see hidden folders and then delete the following folders:
C:\Program Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
C:\Users<your-username>\AppData\Roaming\MySQL
Reinstall MySQL Server Package only
Select another password (looks like the current password is the problem)
Come here and vote me up :)
Do something nice for someone else ;)

Can't Connect to MySql Database via Node.js [duplicate]

I installed XAMPP v3.2.1 because I wanted to learn how to create database in MySQL and learn more about TOMCAT. However, I am a little confused about what to do now. I have read many blogs and the documentation on this page http://dev.mysql.com/doc/refman/5.0/en/creating-database.html.
While following the directions I found that:
I can't access my local host.
Attempted Solution: I shut down skype because I read that might be an issue.
I don't have any older versions of XAMPP on my computer and I don't believe I am connected to any other servers. So, I don't have permission to do anything.
OR
Am I trying to access mysql through the wrong command prompt? I am trying to use MySQL from the XAMPP shell. I am not sure why I cannot get everything working. Am I going about this the wrong way?
Thanks for any help
XAMPP only offers MySQL (Database Server) & Apache (Webserver) in one setup and you can manage them with the xampp starter.
After the successful installation navigate to your xampp folder and execute the xampp-control.exe
Press the start Button at the mysql row.
Now you've successfully started mysql. Now there are 2 different ways to administrate your mysql server and its databases.
But at first you have to set/change the MySQL Root password. Start the Apache server and type localhost or 127.0.0.1 in your browser's address bar. If you haven't deleted anything from the htdocs folder the xampp status page appears. Navigate to security settings and change your mysql root password.
Now, you can browse to your phpmyadmin under http://localhost/phpmyadmin or download a windows mysql client for example navicat lite or mysql workbench. Install it and log in to your mysql server with your new root password.
XAMPP Apache + MariaDB + PHP + Perl (X -any OS)
After successful installation execute xampp-control.exe in XAMPP folder
Start Apache and MySQL
Open browser and in url type localhost or 127.0.0.1
then you are welcomed with dashboard
By default your port is listing with 80.If you want you can change it to your desired port number in httpd.conf file.(If port 80 is already using with other app then you have to change it).
For example you changed port number 80 to 8090 then you can run as 'localhost:8090' or '127.0.0.1:8090'
Changing XAMPP Default Port:
If you want to get XAMPP up and running, you should consider changing the port from the default 80 to say 7777.
In the XAMPP Control Panel, click on the Apache – Config button which is located next to the ‘Logs’ button.
Select ‘Apache (httpd.conf)’ from the drop down. (Notepad should open)
Do Ctrl+F to find ’80’ and change line Listen 80 to Listen 7777
Find again and change line ServerName localhost:80 to
ServerName localhost:7777
Save and re-start Apache. It should be running by now.
The only demerit to this technique is, you have to explicitly include the port number in the localhost url. Rather than http://localhost it becomes http://localhost:7777.
<?php
if(!#mysql_connect('127.0.0.1', 'root', '*your default password*'))
{
echo "mysql not connected ".mysql_error();
exit;
}
echo 'great work';
?>
if no error then you will get greatwork as output.
Try it saved my life XD XD

"#2002 Cannot log in to the MySQL server" on login

I am trying to setup drupal on windows 8 with XAMPP but when I try to login to phpmyadmin, I get this error:
I've tried so many different things but I can't seem to get it working. Both Apache and MySQL are running fine from the XAMPP Control Panel.
If you're on a fresh install, config.inc.php file may not exist. You need to rename/copy config.sample.inc.php file then change the relevant line.
please check below link:
phpMyAdmin is throwing a #2002 cannot log in to the mysql server phpmyadmin.
Your phpMyAdmin has been configured with an administrative user ('controluser') to access some advanced features of phpMyAdmin. However, it does not appear that user exists in MySQL. This suggests that XAMPP has
had some glitch in installation, as I believe the XAMPP package normally configures this all for you.
The solution is rather easy; edit your config.inc.php and comment out a few lines by adding // to the beginning of each line. You should do that for the configuration directives for 'controluser', 'controlpass', and 'pmadb', then re-try.
Once you're connected, you can either decide to add the controluser manually or just leave things how they are and not have access to the more advanced features such as bookmarking queries, favorite tables, and so on.
This specific error can have multiple causes.
In your case I think the following settings might be wrong:
username
password
host
port
Just open the config.inc.php in your phpMyAdmin folder and double check the following lines:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['user'] = 'USER';
$cfg['Servers'][$i]['password'] = 'PASSWORD';
Another possible solution you might want to try, could be my answer to this question: enter link description here

mysql error 2005 - Unknown MySQL server host 'localhost'(11001)

I was using mysql 5.6.11,it usually turned down and show me this:
2005 - Unknown MySQL server host 'localhost'(11001).
Currently my resolution is to turn off the network,than it return to normal.I had searched a lot,but no answer is revalent to it.So,does anyone knows the reason?
ERROR 2005 (HY000): Unknown MySQL server host 'localhost' (0)
modify list of host names for your system:
C:\Windows\System32\drivers\etc\hosts
Make sure that you have the following entry:
127.0.0.1 localhost
In my case that entry was 0.0.0.0 localhost which caussed all problem
(you may need to change modify permission to modify this file)
This performs DNS resolution of host “localhost” to the IP address 127.0.0.1.
I have passed through that error today and did everything described above but didn't work for me. So I decided to view the core problem and logged onto the MySQL root folder in Windows 7 and did this solution:
Go to folder:
C:\AppServ\MySQL
Right click and Run as Administrator these files:
mysql_servicefix.bat
mysql_serviceinstall.bat
mysql_servicestart.bat
Then close the entire explorer window and reopen it or clear cache then login to phpMyAdmin again.
The case is like :
mysql connects will localhost when network is not up.
mysql cannot connect when network is up.
You can try the following steps to diagnose and resolve the issue (my guess is that some other service is blocking port on which mysql is hosted):
Disconnect the network.
Stop mysql service (if windows, try from services.msc window)
Connect to network.
Try to start the mysql and see if it starts correctly.
Check for system logs anyways to be sure that there is no error in starting mysql service.
If all goes well try connecting.
If fails, try to do a telnet localhost 3306 and see what output it shows.
Try changing the port on which mysql is hosted, default 3306, you can change to some other port which is ununsed.
This should ideally resolve the issue you are facing.
Follow these steps to fix this error
Use \connect root#127.0.0.1 instead of \connect root#localhost
if it doesn't work then go to C:\Windows\System32\drivers\etc\hosts and check the IP address attached to host name.
use that IP, so it will be.
\connect root#the_ip_address_you_found

Can't connect to MySQL server on 'localhost' (10061)

I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to "Applying Security settings", at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)).
I do have a port 3306 exception in my firewall for 'MySQL Server'.
Got this error on Windows because my mysqld.exe wasn't running.
Ran "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it.
Didn't have to worry about it from there on out.
To resolve this problem:
go to the task manager
select Services tab
find MySql service
Running
That's all.
You'll probably have to grant 'localhost' privileges to on the table to the user. See the 'GRANT' syntax documentation. Here's an example (from some C source).
"GRANT ALL PRIVILEGES ON %s.* TO '%s'#'localhost' IDENTIFIED BY '%s'";
That's the most common access problem with MySQL.
Other than that, you might check that the user you have defined to create your instance has full privileges, else the user cannot grant privileges.
Also, make sure the mysql service is started.
Make sure you don't have a third party firewall or Internet security service turned on.
Beyond that, there's several pages of the MySQL forum devoted to this:
http://forums.mysql.com/read.php?11,9293,9609#msg-9609
Try reading that.
I had difficulty accessing MySQL while connecting via a localhost connection on the standard port 3306, which worked fine when I installed and configured it for prior classes I had taken in MySQL and Java. I was getting errors like "error 2003" and "Cannot connect to MySql server on localhost (10061)". I tried connecting from both MySQL Workbench (5.2.35 CE) and Netbeans (7.2). I am using Windows 7 64 bit professional.
I tried typing in services.msc in the start menu search box, which opened the services dialog box to show all the services installed in windows. I scrolled down to MySQL and started this service. Subsequent attempts to connect to MySQL from MySQL WorkBench and from the command prompt succeeded.
English:
press Windows + R
write "services.msc". Then press Enter
search for MySQL57 and right click
click on start the service
Français :
Appuyez sur la touche Windows + R
Écrire "services.msc" Puis appuyez sur Entrée
Recherchez MySQL57 et clic droit
Cliquez sur rédémarrer
press Windows key + R
write "services.msc" enter
search for "MYSQL56"
write click on it and start the service
Make sure that your windows host file (located at c://windows/system32/drivers/etc.host) has following line. If not, add it at the end
127.0.0.1 localhost
::1 localhost
Sometimes mysql can not trigger Windows to force start host services if firewall blocks it, so start it manually
win+run>>services.msc, select the "MySQL_xx" where "xx" is the name you have assigned to MySQL host services during setup. Click on 'start' to start from hyperlink appeared on left side.
I tried Kuzhichamadam Inn's solution and found that a slight change needed to be made.
MYSQL57 was a network service. I had tried this repeatedly with no success. When I opened services.msc I found another service for localhost: MySQL. I started that one using the process below and it worked.
run > services.msc > rightclick MySQL > properties >start
I got this error when I ran out of space on my drive.
Go to Run type services.msc. Check whether or not MySQL services are running. If not, start it manually. Once it is started, type MySQL Show to test the service.
To connect locally to MySql, you do not have to setup a firewall with inbound rules. But, even if you already setup iptables to allow the TCP inbound port 3306 and grant the privilege to the user to access the db locally, you may have to setup the bind address in your my.cnf file, edit the default address there and put the server IP address that is running the MySql service.
Since I have struggled and found a slightly different answer here it is:
I recently switched the local (intranet) server at my new workplace. Installed a LAMP; Debian, Apache, MySql, PHP. The users at work connect the server by using the hostname, lets call it "intaserv". I set up everything, got it working but could not connect my MySql remotely whatever I did.
I found my answer after endless tries though. You can only have one bind-address and it cannot be hostname, in my case "intranet".
It has to be an IP-address in eg. "bind-address=192.168.0.50".
run > services.msc > rightclick MySQL57 > properties >set start type option to automatic
after restarting computer
At cmd
cd: C:\
C :\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"
it will become
C:\Program Files\MySQL\MySQL Server 5.7\bin>
type mysql -u root -p
ie C:\Program Files\MySQL\MySQL Server 5.7\bin> mysql -u root -p
Enter password: ****
That's all
It will result in
mysql>
Another possibility:
There are two ways the MySQL client can connect to the server: over TCP/IP, or using sockets. It's possible you have your MySQL server configured to support socket connections, but not network connections.
Nothing to do just "Reset to Default" your firewall setting it will start working.
I read many solutions but nothing worked properly, so at last I reset firewall settings which worked.
finally solved this.. try running mysql in xammp. The check box of mysql in xammp should be unclicked. then start it. after that you can open now mysql and it will now connect to the localhost
Edit your 'my-default.ini' file (by default it comes with commented properties)as below ie.
basedir=D:/D_Drive/mysql-5.6.20-win32
datadir=D:/D_Drive/mysql-5.6.20-win32/data
port=8888
There is very good article present that dictates commands to create user, browse tables etc ie.
http://www.ntu.edu.sg/home/ehchua/programming/sql/MySQL_HowTo.html#zz-3.1
I did not have Mysql server installed, that package was missing and I got it from this link https://dev.mysql.com/downloads/installer/
Right click on My Computer
Click on Manage
Go to Services and Application
Select Services and find MySQL service
Right click on MySQL and select Start