server migration and could not connect to mysql - mysql

I have a Centos 5.5 Server and needs to migrate to a new one with 6.6. I have about three websites, a third party application(service). I need to put all these to my new server and host the websites.
And In the new machine i am not able to connect to mysql, when i try to connect using
mysql -u root the below error is shown.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Please suggest how can i connect with mysql and the migration? I am new to this.
I have tried to change the password using skip grantables and again the result is same.

If you are using plesk 11 then try to login your mysql shell with the following command
mysql -uadmin -p`cat /etc/psa/.psa.shadow`

Related

Can't connect to MySQL with DataGrip via unix socket

it's my first time using DataGrip trying to connect to MySQL in a Ubuntu 18.04 server.
I've added a new user to MySQL. When I try to connect to MySQL using the command MySQL -u user -p works.
But on DataGrip, I've created an ssh tunnel and it's making the connection without any problems.
But when trying to connect to MySQL it gives this error The specified database user/password combination is rejected: [28000][1698] Access denied for user 'user'#'localhost'.
I am sure that the password is correct and in the log file it is showing that it's making the ssh connection, but it gives access denied when connecting to MySQL. If someone could help me, I appreciate it.
To connect to MySQL server using unix sockets follow an article in DataGrip documentation.
Connection via sockets available in DataGrip since version 2021.1.

MySQL Workbench import/export: ERROR 2003 (HY000): Can't Connect to MySQL server on 'localhost' (110)

Using:
Ubuntu 16.04 LTS.
MySQL 5.7.17
MySQL Workbench 6.3
In MySQL Workbench I can connect to my local instance, create a new database and edit this database.
But, if i try to import an sql file I am getting the following error:
ERROR 2003 (HY000): Can't Connect to MySQL server on 'localhost' (110)
It does not matter the size of the sql file - even a simple create table and one column with no data causes the same error.
But, If I use terminal:
mysql -u username -p database_name < file.sql
data imports fine, I can then use Workbench to edit the database no problem.
But, If I then try to export the database, I run into the same problem, but I can export via the terminal.
I am using the root user, with the correct password in each case.
Any pointers would be very gratefully received.. I am stumped!
thank you
You appear to be connecting to localhost so I would assume that mysqlworkbench is trying to lookup a domain socket in a wrong place.
Try to switch to a tcp/ip connection by explicitly setting 127.0.0.1 instead of localhost
https://dev.mysql.com/doc/refman/5.5/en/connecting.html#option_general_socket
For connections to localhost, MySQL programs attempt to connect to the
local server by using a Unix socket file. To ensure that the client
makes a TCP/IP connection to the local server, use --host or -h to
specify a host name value of 127.0.0.1, or the IP address or name of
the local server

Workbench Unknown MySQL server host '127.0.0.1' (0)

I've installed the mysql community server, server is running, and i'm able to connect through command line using
mysql -u root -p -h 127.0.0.1 -P 3307
which is the community server. I've also installed wamp which has its mysql server running on port 3306, the command above also connects to that server again
wamp is running fine and i'm able to get into phpmyadmin just fine, but when i try connecting to either mysql server through localhost using workbench, i'm presented with an error "Failed to connect to MySQL at 127.0.0.1:3307 with user root
Unknown MySQL server host '127.0.0.1' (0)"
I've been searching online for hours now and i can't seem to find any solutions to this. The only problem i'm having is connecting through workbench.
Are there any settings for workbench that i might have to change in order to connect to the servers?
EDIT:
This is all on windows by the way. I've also reinstalled wamp, workbench, and mysql server multiple times

How to create localhost database using mysql?

I download mysql installer here:
http://dev.mysql.com/downloads/installer/
And then I downloaded MySql WorkBench.
At workbench's connection configuration I put hostname as "127.0.0.1", port "3306", user: "root", password is empty. I click "test connection" and it gives me this error:
"Can't connect to MySQL server on '127.0.0.1' (10061)"
What am I missing?
See here for starting the service and here for how to make it permanent.
In short to test it, open a "DOS" terminal with administrator privileges and write:
shell> "C:\Program Files\MySQL\[YOUR MYSQL VERSION PATH]\bin\mysqld"
Consider using the MySQL Installer for Windows as it installs and updates the various MySQL products on your system, including MySQL Server, MySQL Workbench, and MySQL Notifier. The Notifier monitors your MySQL instances so you'll know if MySQL is running, and it can also be used to start/stop MySQL.
removing temp files, and did you restart the computer or stop the MySQL service? That's the error message you get when there isn't a MySQL server running.

How to create a new Server Instance on MySQL Workbench 5.2.25 CE

I've just setup MySQL Workbench 5.2.25 CE on a PC with windows XP service pack 3
When trying to create a new server instance on the localhost, Workbench ask me for a root password regarding the service. I've have not been asked during the setup process to enter a password for root... leaving the password blank (or even inputting a 'fake' password) leads to the folowing error message :
'Connecting to MySQL server localhost...
Can't connect to MySQL server on '127.0.0.1' (10061)'
Using a cmd box and trying to log on mySQL as root (mySQL -u root) I have also the following error : ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
The setup of mySQL went fine and I was not asked for anything... did I something wrong ?
I know this is an old question but ...
Take a look at the my.ini file, If there is a default user/password. use that. If this is set mysql will use this.
You can also try
mysql -uroot -p
if the password is really blank then this will let you in