Mysql


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Mysql
# 1  
Old 09-02-2005
Mysql

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

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 Smilie
# 2  
Old 09-12-2005
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:

Code:
/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)


Last edited by indo1144; 09-12-2005 at 06:37 AM..
# 3  
Old 09-12-2005
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.

Last edited by cbkihong; 09-12-2005 at 08:27 AM..
# 4  
Old 09-12-2005
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Programming

Mysql++

code: #include <mysql/mysql.h> #include <my_global.h> int main(int argc, char **argv) { MYSQL *conn; conn = mysql_init(NULL); mysql_real_connect(conn, "localhost", "zetcode", "passwd", "testdb", 0, NULL, 0); mysql_query(conn, "use vobd_db"); mysql_query(conn, "select *... (1 Reply)
Discussion started by: raj6
1 Replies

2. UNIX and Linux Applications

MySQL Daemon failed to start - no mysql.sock file

After doing a yum install mysql mysql-server on Fedora 14 I wasn't able to fully install the packages correctly. It installed MySQL 5.1. I was getting the following error when running the: mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)... (3 Replies)
Discussion started by: jastanle84
3 Replies

3. Linux

mysql

Hi all, How I can find out how long is mysql server is down and is it writing data or not? thanks, (2 Replies)
Discussion started by: email-lalit
2 Replies

4. Red Hat

MySQL conflicts with mysql-3.23.58-16.RHEL3.1

I am tring to install mysql 5.0 on redhat linux3. In this server mysql 3 is already installed and hence while I install mysql 5 it gives the following error. How I can install mysql 5 with out affect previous installation? bash-2.05b# rpm -i MySQL-server-community-5.0.41-0.rhel3.i386.rpm... (2 Replies)
Discussion started by: johnveslin
2 Replies

5. UNIX for Advanced & Expert Users

mysql would not start: missing mysql.sock

I recently installed mysql-standard-5.0.21-solaris9-sparc-64bit.pkg on a Solaris 9 machine (SunOS 5.9 Generic_118558-19 sun4u sparc SUNW,Ultra-250). The package installation went very smooth, however, starting mysql is a different story. I get the message below everytime I try to start mysql: #... (2 Replies)
Discussion started by: xnightcrawl
2 Replies

6. UNIX for Advanced & Expert Users

MySQL problem >> missing mysql.sock

MySQL on my server is down.... I figured out that the mysqld process isn't running. When I try to run it, it says it can't find mysql.sock Any suggestions? Here's what I can't do: can't be root don't have physical access (do stuff via SSH) reinstall MySQL (need to keep the current MySQL... (8 Replies)
Discussion started by: _hp_
8 Replies
Login or Register to Ask a Question