Can't start server : Bind on unix socket: Permission denied
Hi Guys, Ahem...er, I've dropped a clanger! I tried to move my datadirectory to another device with more room. And yes, I know NOW that I should have created symbolic links for the databases in question but...well, the rest is history... * First Tech info: Red Hat Linux v7.0, Intel. Latest version of MySQL = 3.23.39 6049585 Jul 11 10:29 MySQL-3.23.39-1.i386.rpm 698022 Jul 11 13:31 MySQL-bench-3.23.39-1.i386.rpm 1772486 Jul 11 11:08 MySQL-client-3.23.39-1.i386.rpm 232649 Jul 11 11:03 MySQL-shared-3.23.39-1.i386.rpm So: 1. Shutdown server. 2. Copied datadir (/var/lib/mysql) to new directory in its entirity (/x/mysql). 3. Edited startup script (/etc/init.d/mysql) and changed the entry datadir=/var/lib/mysql to datadir=/x/mysql 4. Restarted server - server came up OK but I couldn't connect to it. 5. Shutdown server. 6. Edited startup script back as normal (/var/lib/mysql) 7. COULD NOT RESTART SERVER (see my error log below). It seems that there is a file called mysql.sock which is causing the problems. Any ideas anyone? datadirectory (/var/lib/mysql) = drwxr-xr-x6 root root 1024 Jul 31 09:23 mysql extract from /etc/init.d/mysql # Set some defaults datadir=/var/lib/mysql basedir= pid_file= *** extract from my error log (the first bit must be when I shut down and there was idle users connected). 010725 15:08:56 Aborted connection 311 to db: 'norasia' user: 'adminit' host: `localhost' (Got an e rror reading communication packets) 010731 8:52:14 Aborted connection 555 to db: 'unconnected' user: 'root' host: `localhost' (Got an error writing communication packets) 010731 8:52:14 /usr/sbin/mysqld: Normal shutdown 010731 8:52:14 /usr/sbin/mysqld: Shutdown Complete 010731 08:52:14 mysqld ended 010731 08:59:06 mysqld started 010731 8:59:06 /usr/sbin/mysqld: Can't create/write to file '/x/mysql/mail.dcaliner.co.uk.pid' (Er rcode: 13) /usr/sbin/mysqld: ready for connections 010731 09:07:12 mysqld ended 010731 09:16:51 mysqld started 010731 9:16:51 Can't start server : Bind on unix socket: Permission denied 010731 9:16:51 Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.s ock ? 010731 9:16:51 Aborting 010731 9:16:51 /usr/sbin/mysqld: Shutdown Complete 010731 09:16:51 mysqld ended 010731 09:19:04 mysqld started 010731 9:19:04 Can't start server : Bind on unix socket: Permission denied 010731 9:19:04 Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.s ock ? 010731 9:19:04 Aborting 010731 9:19:04 /usr/sbin/mysqld: Shutdown Complete 010731 09:19:04 mysqld ended Neil Barnes, Systems Manager DCA Liner Limited 4 Pennine Way, Saltley Business Park, Saltley, Birmingham B8 1JW T: +44 121 325 7527 F: +44 121 328 2552 E: [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Can't start server : Bind on unix socket: Permission denied
FIXED. For those that don't know go through the searchable archive of this mailing list (http://lists.mysql.com) ... I should have done in the first case! Anyway, if ever you get the socket error described below it's just a case of setting your permissions correctly. chmod 700 datadir (e.g chmod 700 /var/lib/mysql ) So, below is an idiots guide to moving a database somewhere else (on same host). Which is where all my problems originally started. All actions performed from the root user account (steady kids). 1. Make a directory on the filesystem where you want to put the database (in my case the /x filesystem) mkdir /x/mysql mkdir /x/mysql/testdb {testdb = name of database} 2. Change ownership on the directories: { mysql = username of MySQL admin account) chown mysql /x/mysql chown mysql /x/mysql/testdb 3. Change protection mode on above directories: chmod 700 /x/mysql chmod 660 /x/mysql/testdb chgrp mysql /x/mysql/testdb 4. Shutdown mysql server mysqladmin -p shutdown 5. Copy database files from original directory to new directory cp -rp /var/lib/mysql/testdb /x/mysql 6. Check permissions (see 2 + 3 above) 7. Rename original database directory to something safe as a backup. mv /var/lib/mysql/testdb /var/lib/mysql/testdb.sav 8. Create symbolic link: ln -s /x/mysql/testdb /var/lib/mysql/testdb 9. Restart Server: /etc/init.d/mysql start (or your usual method) Hey Tesco, everything should work. (This process worked for me on a REd Hat 7.0 machine - intel ). Mind you, this is only a test machine with a small database. On a larger production database you would probably want to make a dump of the database first as an additional safeguard - all I've done here is to preserve the original database directory (renamed /testdb to /testdb.sav) Hope this is of some use to somebody. rgds Neil. At 10:54 31/07/01, Neil Barnes wrote: Hi Guys, Ahem...er, I've dropped a clanger! I tried to move my datadirectory to another device with more room. And yes, I know NOW that I should have created symbolic links for the databases in question but...well, the rest is history... * First Tech info: Red Hat Linux v7.0, Intel. Latest version of MySQL = 3.23.39 6049585 Jul 11 10:29 MySQL-3.23.39-1.i386.rpm 698022 Jul 11 13:31 MySQL-bench-3.23.39-1.i386.rpm 1772486 Jul 11 11:08 MySQL-client-3.23.39-1.i386.rpm 232649 Jul 11 11:03 MySQL-shared-3.23.39-1.i386.rpm So: 1. Shutdown server. 2. Copied datadir (/var/lib/mysql) to new directory in its entirity (/x/mysql). 3. Edited startup script (/etc/init.d/mysql) and changed the entry datadir=/var/lib/mysql to datadir=/x/mysql 4. Restarted server - server came up OK but I couldn't connect to it. 5. Shutdown server. 6. Edited startup script back as normal (/var/lib/mysql) 7. COULD NOT RESTART SERVER (see my error log below). It seems that there is a file called mysql.sock which is causing the problems. Any ideas anyone? datadirectory (/var/lib/mysql) = drwxr-xr-x6 root root 1024 Jul 31 09:23 mysql extract from /etc/init.d/mysql # Set some defaults datadir=/var/lib/mysql basedir= pid_file= *** extract from my error log (the first bit must be when I shut down and there was idle users connected). 010725 15:08:56 Aborted connection 311 to db: 'norasia' user: 'adminit' host: `localhost' (Got an e rror reading communication packets) 010731 8:52:14 Aborted connection 555 to db: 'unconnected' user: 'root' host: `localhost' (Got an error writing communication packets) 010731 8:52:14 /usr/sbin/mysqld: Normal shutdown 010731 8:52:14 /usr/sbin/mysqld: Shutdown Complete 010731 08:52:14 mysqld ended 010731 08:59:06 mysqld started 010731 8:59:06 /usr/sbin/mysqld: Can't create/write to file '/x/mysql/mail.dcaliner.co.uk.pid' (Er rcode: 13) /usr/sbin/mysqld: ready for connections 010731 09:07:12 mysqld ended 010731 09:16:51 mysqld started 010731 9:16:51 Can't start server : Bind on unix socket: Permission denied 010731 9:16:51 Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.s ock ? 010731 9:16:51 Aborting 010731 9:16:51 /usr/sbin/mysqld: Shutdown Complete 010731 09:16:51 mysqld ended 010731 09:19:04 mysqld started 010731 9:19:04 Can't start server : Bind on unix socket: Permission denied 010731 9:19:04 Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.s ock ? 010731 9:19:04 Aborting 010731 9:19:04 /usr/sbin/mysqld: Shutdown Complete 010731 09:19:04 mysqld ended Neil Barnes, Systems Manager DCA Liner Limited 4 Pennine Way, Saltley Business Park, Saltley, Birmingham B8 1JW T: +44 121 325 7527 F: +44 121 328 2552 E: [EMAIL PROTECTED
AW: Can't start server : Bind on unix socket: Permission denied
Dave, to install mysql to run as a normal user is not that hard. Just follow these instructions Installation of mysql -- You will create a user and a group for the mysql-user. Then you will create a directory, for the mysql-user to live in. After compiling and installation you will have to 'donate' the new directory to the user. The directory, that you will use is /opt/mysql. 1.) Make a group and a user for the mysql-user groupadd mysql useradd -g mysql -d /opt/mysql -c "The MySQL-server" mysql 2.) Create a home-directory for mysql mkdir /opt/mysql 4.) Extract the mysql-source to /usr/src and change to the top level-dir of the extracted packages You will configure the source to be installed to the /opt/mysql-directory: Change ID to root and enter: ./configure --prefix=/opt/mysql \ --with-mysqld-user=mysql \ --with-unix-socket-path=/opt/mysql/var/mysql make make install scripts/mysql_install_db chown -R mysql.mysql /opt/mysql Explanation: --prefix=/opt/mysql: install to this directory --with-mysqld-user=mysql: Run as user "mysql" --with-unix-socket-path=/opt/mysql/var/mysql: use this file (fifo) to communicate with the server The script mysql_install_db installs the initial databases, that contain the user and database ownership and permission system. chown -R mysql.mysql /opt/mysql: This grants the mysql-user (nearly) unlimited access to the /opt/mysql-directory In the directory /usr/src/mysql-XXX you find a script, that you can use to start and stop the mysql-daemon in the various runlevels. It is called "mysql.server". To install it, do the following: For SuSE-Linux copy it to /sbin/init.d/mysql. Then you will link it to the various runlevels: for i in 2 3; do cd /sbin/init.d/rc$i.d ln -s /sbin/init.d/mysql S99mysql done for i in 0 1 6 S; do cd /sbin/init.d/rc$i.d ln -s /sbin/init.d/mysql K01mysql done This assures, that the mysql-daemon is being started in runlevels 2 and 3. For other distributions like Red Hat do this: for i in 3 4 5; do cd /etc/rc$i.d ln -s /etc/init.d/mysql S99mysql done for i in 0 1 2 6; do cd /etc/rc$i.d ln -s /etc/init.d/mysql K01mysql done This assures, that the mysql-daemon is being started in runlevels 3 to 5. Finally, give the mysql-root-user a password: Start the mysql-daemon and log in. Then do this: mysql UPDATE user SET Password=PASSWORD('new_password') WHERE user='root'; mysql FLUSH PRIVILEGES; You are done. Good luck and have fun! Wolfgang Wolfgang, I checked permissions on all files that are related to mysql to allow anyone to do anything. Mysql boot without a hitch. Thanks a lot. I guess I am still going to have to figure out how to bring mysql up as a normal user. Thanks again, Dave At 10:42 AM 1/30/01 +0100, you wrote: Don't reinstall! The problem can be solved very easily. The error-message informs you, that the mysql-user can not access a certain file. Give this file to the mysql-user. (I mean, do: "chmod mysql.mysql /tmp/mysql.sock", assumed that the mysql-user is named "mysql", that he is member of the group "mysql" and that the file, that could not be accessed is "/tmp/mysql.sock") Wolfgang Arendt Vodafone TeleCommerce GmbH SW Test Config. Management Wolfgang Arendt Daniel-Goldbach-Str. 17-19 40880 Ratingen Tel. +49 (0) 21 02 / 97 2492 Fax +49 (0) 21 02 / 97 2453 mailto:[EMAIL PROTECTED] www.vodafone-telecommerce.de -Ursprngliche Nachricht- Von:[EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]] Gesendet am:Montag, 29. Januar 2001 21:29 An: [EMAIL PROTECTED] Betreff: Can't start server : Bind on unix socket: Permission denied I am trying to bring up my third mysql server. This one is MySQL-3.23.32-1.i386.rpm..rpm on a redhat 6.2 base. I was successful in installing both the server and the host. Look around and every thing looked cool! Piece of Cake! Then I decided to s
Can't start server : Bind on unix socket: Permission denied
I am trying to bring up my third mysql server. This one is MySQL-3.23.32-1.i386.rpm..rpm on a redhat 6.2 base. I was successful in installing both the server and the host. Look around and every thing looked cool! Piece of Cake! Then I decided to set up the mysqladmin user and setup privelidges, etc. The other two servers are run as root with no security. Every thing has gone down hill. All I get is this message: 'Can't start server : Bind on unix socket: Permission denied' whenever I try to start mysql.I've even rebooted the unix a few times, rebuilt the initial data base, etc.Tried every command I could find in the doc, but it won't budge. Only trying to get mysql to startup as root. I am about ready to start from scratch ... but reformat the drives and re-installing redhat seems too drastic. Please help. The hardware is IBM 6000R Netfinity with 1.5 g memory, dual 700 mh pentium processors, 200 g scsi raid set up as 1E. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php