Can't connect mysql-server docker wth mysqlshell - mysql

I'm trying connect to mysql-server docker container from my host with mysqlshell(mysqlsh) client and native mysql installer yum on fedora but in mysqlsh and in native mysql installer client i have same error message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
But when i connect to docker container mysql-server with bash i can to connect to mysql with no problem and execute SQL's commands etc
i ran the following docker command
sudo docker run --name=mysql-teste -p 3606:3606 -d mysql/mysql-server
My O.S: Fedora 30
Docker version 1.13.1, build 1185cfd/1.13.1
I don't have mysql-server installed on my host i only want connect from my host to mysql-server docker container.
Someone has a same problem?

Make sure you have mysql server installed and running, then it should work ok
see:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Related

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' . Error after installation

Errors
After running service mysqld status in Ubuntu 20.04, I get the error:
Unit mysqld.service could not be found.
And after running sudo mysql I get:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
Info
I've just installed MySQL with command
sudo apt-get install mysql-server.
There were no errors during installation. Reinstalling doesn't help. I've also tried to find problem in config files, but I don't have /etc/my.cnf. I am not sure, if it's ok.
systemctl start mysql does not help.
By the way, service mysql status works just alright and returns active status.
Resolved question.
Delete /usr/local/mysql, /usr/local/bin/mysql, /usr/bin/mysql
Reinstall MySQL by
sudo apt-get update
sudo apt-get install mysql-server

Connect to mysql remote server docker

I am trying to connect to a RDS instance inside a docker container. I have tried to telnet in the host and everything is working correcting. When trying to do the same inside the docker container it returns this error:
(2003, 'Can\'t connect to MySQL server on \'xxx.xxx.us-east-1.rds.amazonaws.com\' (110 "Operation timed out")')
The docker container has as base image alpine:3.7 and I have installed MariaDB packages (mariadb-dev, mariadb, mariadb-client).
I have debugged and I have narrowed down to a connection between container and external remote servers.
Dockerfile:
FROM alpine:3.7
RUN apk add --no-cache mariadb mariadb-dev mariadb-client python3
RUN pip3 install <django-packages>
...
ENTRYPOINT ["./entrypoint.sh"] # Run app and supervisord processes
CMD ["sh"]

MySQL.sock doesn't exist | CentOS7 - ERPNext installation

I'm trying to install ERPNext with their install script provided at github (https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh) on my virtual CentOS 7 server. It has MariaDB 10.x installed and I have to remove it first, before I use the script, otherwise I get an error.
But I don't have a solution for following problem, could you guys help me out?
sudo bash setup_frappe.sh --setup-production
Installing for centos 7 amd64
In case you encounter an error, you can post on https://discuss.frappe.io
Adding centos mariadb repo
Installing packages for centos. This might take time...
Installing wkhtmltopdf
Configuring CentOS services
Starting services
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
In Cmd try this:
sudo service mysql stop
sudo service mysql start

What's the correct way of installing MySQL on CentOS 6.6 on Compute Engine by Google?

I've been trying to install MySQL on CentOS 6.6 but with no good results. I have just created a new VM with these steps:
1.- sudo yum -y install mysql-server mysql
2.- sudo mysql -u root
RESULT .- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
also doing a "sudo service mysql start"
RESULT mysql: unrecognized service
Thanks mates !
Try
sudo /etc/init.d/mysqld start
or
sudo service mysqld start

mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I installed (on Ubuntu 13) MYSQL using
sudo apt-get install mysql
But after running
mysql -u root -p
and entering the password it gives the error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
Please guide...
Problem:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
Solution:
sudo service mysql start
I solved it by stopping the apache server first and restarting the mysql server
sudo service apache2 stop
sudo service mysql stop
sudo service mysql start
sudo service apache2 start
Hope this can help you
(Env: docker ubuntu16.04 container):
i run this code each time restart mysql server, it work for me:
sudo chown -R mysql:mysql /var/lib/mysql /var/run/mysqld
sudo service mysql start
Make sure that Mysql is installed, still able to reproduce the issue, Look for the file in sql/my.cnf file.
Verify that the Socket connection path in that file:
Location shown in the error is: /var/run/mysqld/mysqld.sock
Actually location in my.conf file : /home/user/mysql/tmp/mysqld.sock
home/sql/bin >> mysql -u root -p --socket=/home/user/mysql/tmp/mysqld.sock
In some version's you may find 'mysql.sock' instead 'mysqld.sock'
I know it's too late, but I had same problem today.
It solved by removing current mysql and reinstalling mariadb.
It worked for me.
sudo apt install mariadb-server
Create one micro instance swap space in Ubuntu
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile