Wamp- command line "mysqld" doesn't work - mysql

When I write the command line C:\wamp\bin\mysql\mysql5.6.17\bin>mysqld
nothing happens. It just shows the path again C:\wamp\bin\mysql\mysql5.6.17\bin>
and when I write this:
C:\wamp\bin\mysql\mysql5.6.17\bin>mysql
it shows an error: ERROR 2003 (HY000): Can't connect to mysql server on 'localhost' (10061)
I tried a lot to find an answer to this, but I couldn't find anything useful. Why isn't the server working?
I installed the same program for my friend, too and it works fine for her.

The error ERROR 2003 (HY000): Can't connect to mysql server on 'localhost' (10061) means that the MySQL server daemon is not running and so the client mysql can not connect. That makes sense, because mysqld doesn't start.
There are plenty of reasons, often its simply a misconfiguration or port collision (3306 already used?).
The first step is to make sure that the daemon is working without a configuration file. Please try to start the daemon by using mysqld --no-defaults.
no-defaults means that mysql will not read any option files, before starting.
If it starts up, you know that the configuration file(s) are to blame.
Then search in your my.ini for "wrong" or "old and deprecated" entries and fix them, to allow a normal startup. Its also helpful to enable logging.
If you are in doubt, go with one of the default configuration files: https://dev.mysql.com/doc/refman/5.6/en/server-default-configuration-file.html
You can check the ports with a tool like CurrPorts:
http://www.nirsoft.net/utils/cports.zip

Related

MySql Workbench, Can't connect to MySQL server on 'localhost' (10061) (2003)

This might seem like a duplicate but trust me its not
So you guys are probably familiar with the error. The server doesnt start at the beginning and when i try to start it from Startup/Shutdown it gives this error.
Most of the people with this problem fixed it by starting MySQL server manually. Yeah but problem is mine was already working, i mean the server is on both in services and task manager. But for some reason im getting this error.
So my question is, how can i fix this?
- Checking server status...
- Trying to connect to MySQL...
- Can't connect to MySQL server on 'localhost' (10061) (2003)
- Assuming server is not running
Tried finding some logs but all says the same as above
Oh and i tried shutting the server down and opening again
Do you guys think that it might be happening because it is conflicting with some other sql program? I uninstalled everything related to sql but i might miss some stuff.
Programs i used to have are
-XAMP
-SQL Manager
-Microsoft SQL Server
-Microsoft SQL Server Management Studio
Like I said though, i uninstalled them all.
You need to check for all the mysql configuration files in /etc/mysql and check for any lines containing 127.0.0.1 and bound address or skip network and comment them.
Hope it helps.
It seems like for some reason it was having a conflict with other connection or port was just wrong on set up. I tried deleting all the connections i have and started a fresh one and it worked. Weird right? Here i was thinking when you uninstall MySQL, it woudl delete all the connections too.

MySQL server has gone away after Shutdown and Startup Server

I am using MySQL Workbench. I shut down and restart my server. After that I was not able to execute any queries as the error always come up immediately.
Error 2006:MySQL server has gone away
I have started the MySQL57 services manually so I am sure the server is running. Looking up SO, two solutions come up - (1) set max_allowed_packet = 128M in my.ini [Failed], (2) set wait_timeout to a larger number - I cannot find the my.cnf file so this doesn't work.
What I encountered is pretty different from others as they usually had this error after a long piece of queries, but mine just comes up immediately after a query is sent. Appreciate any help (include finding the my.cnf file).
Update:
Discovered something that may help, what I have done:
Start MySQL57 from services.msc manually
Open MySQL Workbench, connect to database
Test the connection, and said "Successfully made the MySQL Connection"
Run a query, return "Error 2013: Cannot connect to MySQL Server on local host"
Run the query again, return "Error 2006: MySQL Server has gone away"
Check services.msc, the MySQL57 has been switched off.

How to fix 'Can not connect to MySQL server' error?

First of all I apologize for my English is not perfect.
I'm trying to connect to mysql database remotely.
I have already done the basic steps such as, for example, comment the bind address in my.cnf.
I gave permissions to the appropriate users in MySQL.
I tried with my friend to do it connect to the database, and it worked but we were in the same room with the same router.
Now I'm home and I tried to connect my friend, but I always get error:
ERROR 2003 (HY000): Can not connect to MySQL server ....
Maybe it's a problem of my home router? I can not even do the telnet.
P.S. I've also taken steps to set the firewall.
Some reasons for that,
mysqld is not running on the local host. Check your operating
system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections
to it. If you're experiencing that quite often your clients get that
error, you can find a workaround here: Section B.5.2.2.1, “Connection
to MySQL Server Failing on Windows”.
Check whether the server is running on that host by executing telnet
some_host 3306 and pressing the Enter key a couple of times. (3306 is
the default MySQL port number. Change the value if your server is
listening to a different port.) If there is a MySQL server running
and listening to the port, you should get a response that includes
the server's version number. If you get an error such as telnet:
Unable to connect to remote host: Connection refused, then there is
no server running on the given port.
Look at this mySQL full documentation, it will be helpful.

unable to connect to mysql socket from C program

I am developing a C program that accesses mysql. I have the following line in my code:
sts = connect_to_server(&mysql, "localhost", "my_username",
"my_password, "my_databasename");
with the actual values replaced, of course. I get:
Failed to connect to MySQL: Error: Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (2)
I have seen other questions like this, and the answer is usually that the server is down. In this case it is not. PHPMyAdmin can access the server just fine.
And many of the other responses said to check for the socket file. It is present
(/Applications/AMPPS/mysql/tmp/mysql.sock).
Could this be something to do with paths or something? It isn't adding the path to "/temp/mysql.sock" and therefore can't find it?
I know very little about unix. I have been running OSX for nearly 10 years, but I almost never go down to that level.
Take a look into the mysql configuration file (typical my.cnt somehwhere under /etc) and adjust the value for socket to fit your needs.
Alternativly you could just link /tmp/mysql.sock to /Applications/AMPPS/mysql/tmp/mysql.sock:
ln -s /Applications/AMPPS/mysql/tmp/mysql.sock /tmp/mysql.sock
I think wrong my.ini is getting loaded. By default it looks at /etc/my.ini so if it is present just rename or delete it. Restart your MySQL Server.

Remote mySQL connection throws "cannot connect to MySQL 4.1+ using the old insecure authentication" error from XAMPP

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!