Mysql

Is it my opinion, or Unix & Linux systems dislike me???? :slight_smile:

New problem

I want to mysqldump a database from a Red Hat 9 mysql server,
to a Solaris 7 mysql server.

the problem is :

Mysql server in Red Hat 9 is up and running. (Its the production server).
I'm trying to mysqldump a database, and provides me the below error.

/usr/local/mysql/bin/mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect

Remember, this server is up and running.

I'm searching everywhere for mysql.sock, or *.sock, and I can't find anything.
there is no mysql.sock file in the system (hidden or not).
There is no .sock file in the system.

mysqld.log it exists but is empty, so I can't get any information from there.

Now,

in Solaris 7, mysql.sock exists, in a proper location '/tmp/mysql.sock',
but its empty.
Mysql server, in Solaris 7, its also up and running.

My obvious question is , how to make mysqldump work without any mysql.sock file in the system????

But I want to add another question.
If I'll create, in Red Hat 9, a '/tmp/mysql.sock' file, empty of course, will it cause any damage to the mysql server, which is up and running????????

Thanks again.

I'll never give up, never give in :slight_smile:

I am not a MySQL guru, I sometimes need to do administrative jobs though and have run into the same problem from time to time.

From the RH-machine, can you connect to your database using "mysql -u root -p" ?

Depending on your permissions, you sometimes must sometimes use this notation:

mysql -u root -p
mysql -h localhost -u root -p (connect using localhost)
mysql -h 192.168.0.1 -u root -p (connect using IP)
mysql -h mymachine -u root -p (connect using hostname)

If any of these fail, you may have other problems, check mysql-permissions.

To dump the entire database-server (including all databases, tables, including create-statements) I sometimes use this:

/usr/bin/mysqldump --all-databases --opt --user=root --password=xxxxxx > /root/scripts/mysql_backup/dump.sql
(run from database server itself, so I do not use -h option)

If you use some sort of GUI to connect to the database, you may be able to find somewhere that display a list of server variables. If you use command-line, use the "show variables" command, and post here the value for the "socket" option displayed. Note that you should pass nearly the same set of arguments as mysql to mysqldump. If mysql works, so should mysqldump.

You cannot simply create the mysql.sock file on your Redhat system. This is not a standard file but a 'socket' through which a process can communicate with the mysqld process. It is used on the local machine (rather than comunicating directly via tcp) because it's more efficient.

To be honest it looks like you've got 2 different versions of mysql on the your Redhat box and the mysqldump you are running is not from the same base install as the server.

Can you do a 'ps -elf' and check which mysqld (or possibly safe_mysqld) is currently running? Make sure its the one in /usr/local/mysql/bin. If it is then you need to check to see if the 'default socket file' has been overridden. This could of been done on the command line when mysqld was started or in the 'my.cnf' file. The 'my.cnf' file unfortunately could again be in a standard location (/etc/my.cnf, /etc/mysql/my.cnf, /usr/local/mysql/mf.cnf etc etc) or could be specified on the command line.