Why is it that when I use this setting in my my.conf:
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid
I get lightning fast speeds in http, but as soon as it moved to https I get the "Unable to establish connection to database" error. If I switch it back to my old:
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
it's much slower, but https works fine. Nothing shows up in the error log in the first example. I would LOVE to keep the /var/lib socket speeds, but I need https to work on the site.
I figured it out. If you edit the socket location in my.conf, you have to change it in /etc/mysql/debian.cnf to match (obviously, for Debian based distros.)
Related
despite I've tried everything suggested in the forum I still can't connect to MySQL remotely.
This is my my.cnf file:
[mysqld]
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I've tried also adding the line bind-address = 0.0.0.0 but still doesn't work.
Then I deleted it because I've preferred leave the default configuration of my webserver and because I've read that, if is not specified, it is 0.0.0.0 by default.
I have the port 3306 open as you can see from my webmin module:
Linux IPTables Firewall
I've created the MySQL account named 'michele' as you can see from my webimn module User Permissions
and also I granted to michele the permissions for any database Database Permissions
and granted to any host all permissions Host Permissions
To test my remote connection I'm trying to connect from MySQL for excel. that is the error error MySQL fro excel
It is impossible to stabilize the connection. Incorrect response of
the connected party after the time interval or no response from the
connected host MY-IP-SERVER:3306
Also I want to inform you that this is my second attempt to connect remotely. In my first I made it! For a problem that doesn't deal with the remote connection I needed to reinitialize my server and here I am.
The first time I remember that in some configuration file I've put # for comment some line but I don't remember which and if it deal with my problem. Please help me I'm going to be mad!
Michele
I made it!
The problem was for the ipTable rule:
REJECT reject with icmp-host-prohibited
rule
so for solve the problem I deleted it.
on my server shell with root permission:
# sudo iptables -L --line-numbers
find the id rule
and then deleted it:
# sudo iptables -D INPUT 10
I am having problems launching MySQL on my local machine. Every time I try to launch the instance I get an:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
For creating the required file I followed this solution changing the directory /var/lib/... to /var/run/... since it is how my configuration is set. The weird thing is that when I follow the steps described the process is launched and I can access to my database, but after a while it suddenly stops and the files (mysqld.sock and mysqld.pid) dissappear. How can this be possible? How can avoid it from happening?
The settings on my 50-server.cnf of my mariadb are:
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = localhost
I am using Amazon Cloud to deploy my web services. However, this requires a MySQL instance and I already installed it. In order to allow remote connectivity to MySQL database, I followed the below sequence as elaborated in MySQL documentation and even in the below thread.
Edit my.cnf file to change the following.
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = <server ip OR 0.0.0.0>
The same solutions discussed in detail, following posts.
Remote Connections Mysql Ubuntu
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
However, as soon as I edited the my.cnf file as mentioned, the MySQL server failed to restart. I tried my best to recover this, it's failing instead.
Could anyone help me to identify and resolve the issue, would be a great help.
Verify that the MySQL server isn't running.
Try setting the bind-address to 0.0.0.0
bind-address = 0.0.0.0
Verify that the files are deleted
/var/run/mysqld/mysqld.sock
/var/run/mysqld/mysqld.pid
I am hosting my own web server and am trying to access my MySQL database from my laptop (not the server). On my laptop I have added the following to the config.inc.php file:
$i++;
$cfg['Servers'][$i]['verbose'] = 'xx.xxx.xxx.xxx';
$cfg['Servers'][$i]['host'] = 'xx.xxx.xxx.xxx';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'nick';
$cfg['Servers'][$i]['password'] = 'xxxxxxx';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
I have created, on the server, a user named "nick" with all grants. I have tried a LOT of different configurations of the code above and I just cannot connect remotely.
The host IP is the IP of my router that is using a DNS linking it to the domain name, I would imagine it is the same host needed here. I am port forwarding 8080 for my website and using a port 80 rerout with the DNS. I get this error when trying to connect to the server from my laptop:
Error
MySQL said: Documentation
2002 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
The server is not responding (or the local server's socket is not correctly configured).
Somebody please help, I do not want to spend forever on this :/ I'm supposed to be working on the website, not the MySQL remote connection haha!
MySQL runs on port 3306, it sholdn't be blocked. It wasn't for me.
Then make sure that your mysql allows connections from the outside.
Just edit your my.cnf file
If you are using Debian Linux file is located at /etc/mysql/my.cnf location.
If you are using Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location.
If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf location.
$ nano my.cnf
Go down until you find [mysqld]
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 65.55.55.2
# skip-networking
Modify "bind-address" to the ip of your server so that it listens on it (it is default to localhost).
In Windows Firewall create an exception for port 3306. Make sure that the port is also being forwarded.
I can't figure out why i cant access a remote MySQL server in ubuntu inside a VMware. I already have the codes, and it's successfully connecting to my localhost as well as insert, delete and update of data's. But when I make a new connection string with specified IP server address it show an error:
I can only access the files in that server through SSH and browser (192.168.56.xxx/phpmyadmin).
Here's my code for connection string.
Dim conn As New MySqlConnection
conn.ConnectionString = "Server=192.168.56.xxx;port=3306;User=root;password=mypassword;Database=prodDB_vb"
conn.Open()
MessageBox.Show("Connection to Database has been opened.")
cmd.Connection = conn
I already read a lot of forums about this. But dont understand what they are pointing to.
Also i executed the code:
GRANT ALL PRIVILEGES ON prodDB_vb TO 'root#*' IDENTIFIED BY 'my_password';
FLUSH PRIVILEGE;
The only thing i know is that i cannot find the my.cnf in the server files, but already change my my.ini in my localhost's bind ip address.
#bind-address="127.0.0.1"
3306 is listening
And i have this in my my.cnf
Why having this error?
Anyone please help.
Did you check to make sure that MySQL is actually listening on 3306? Run a netstat -tlpn and provide the results. If you don't see 3306 then its probably not.
In my.cnf you should verify that --skip-networking is commented out
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 65.55.55.2
# skip-networking
To locate your CNF file
Edited:
For example, if your MySQL server IP is 192.162.0.3 then entire block should be look like as follows:
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 192.168.0.3
# skip-networking
....
..
....
bind-address : IP address to bind to.
skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.
Then we have to Restart mysql service to take change in effect:
/etc/init.d/mysql restart