You need to specify the socket for the mysql client using the --socket=path option. You changed it in my.cnf (so either move it back - it probably belongs in /var/lib/mysql - or specify it every time).
On 28 Jan 2012, at 1458, Philipp Schiffer wrote: > Hi everybody, > > thanks to fast help from several people mysql starts up: > Starting mysqld: [ OK ] > I had to "chcon -t var_t /data" to allow mysql to get through to /data, so > special thanks to Chris and Stephan for that one. > Anyway, now trying to get into mysql (as root) I do get > ERROR 2002 (HY000): Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > and don't understand why that should be. Any suggestions? > > Best > > Phil > > Am 28.01.12 21:31, schrieb Philipp Schiffer: >> Hi! >> >> Populating my mysql on SL6.1 with biological data I ran into my primary >> SSDs limit and thus tried to move the location to another disk (HD). So >> I sudo cp -R'ed everything from /var/lib/mysql to /data/mysqldata and >> changed the permissions accordingly >> drwxr-xr-x. 10 mysql mysql 4096 Jan 28 12:20 mysqldata >> and inside mysqldata >> drwx------. 2 mysql mysql 4096 Jan 28 12:20 b2g >> -rw-r-----. 1 mysql mysql 178257920 Jan 28 20:50 ibdata1 >> -rw-r-----. 1 mysql mysql 5242880 Jan 28 20:50 ib_logfile0 >> -rw-r-----. 1 mysql mysql 5242880 Jan 28 20:50 ib_logfile1 >> drwx------. 2 mysql mysql 4096 Jan 28 12:20 mysql >> drwx------. 2 mysql mysql 4096 Jan 28 12:20 orthotest >> Then went on to modify /etc/my.cnf to >> [mysqld] >> #datadir=/var/lib/mysql >> datadir=/data/mysqldata >> #socket=/var/lib/mysql/mysql.sock >> socket=/data/mysqldata/mysql.sock >> user=mysql >> # Disabling symbolic-links is recommended to prevent assorted security >> risks >> symbolic-links=0 >> #basedir=/data >> >> [mysqld_safe] >> log-error=/var/log/mysqld.log >> pid-file=/var/run/mysqld/mysqld.pid. >> >> Having stopped the server before doing all this I now started again, but >> it failed to work. less /var/log/mysqld.log says: >> 120128 21:03:08 mysqld_safe mysqld from pid file >> /var/run/mysqld/mysqld.pid ended >> 120128 21:09:06 mysqld_safe Starting mysqld daemon with databases from >> /data/mysqldata >> 120128 21:09:06 [Warning] Can't create test file >> /data/mysqldata/superrechenknecht.lower-test >> 120128 21:09:06 [Warning] Can't create test file >> /data/mysqldata/superrechenknecht.lower-test >> ^G/usr/libexec/mysqld: Can't change dir to '/data/mysqldata/' (Errcode: 13) >> 120128 21:09:06 [ERROR] Aborting >> >> 120128 21:09:06 [Note] /usr/libexec/mysqld: Shutdown complete >> >> 120128 21:09:06 mysqld_safe mysqld from pid file >> /var/run/mysqld/mysqld.pid ended >> >> Tried to set a symbolic link from /var/lib/mysql -> /data/mysqldata but >> that failed to work as well (actually why can't I change the ownership >> of the link from root:root to mysql:mysql?). Finally reading up on >> SElinux I edited my new mysql directory /data/mysqldata to look the same >> as the original mysql folder: >> drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysqldata >> drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql_old >> >> and within mysqldata: >> drwx------. mysql mysql system_u:object_r:mysqld_db_t:s0 b2g >> -rw-r-----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ibdata1 >> -rw-r-----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ib_logfile0 >> -rw-r-----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ib_logfile1 >> drwx------. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 mysql >> drwx------. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 orthotest >> drwx------. mysql mysql system_u:object_r:mysqld_db_t:s0 sknstuff_insp >> >> However, even that does leads to the same error messages in the log file >> and I am really at a loss. Any help with this would be highly >> appreciated (especially as I need a working db quite urgently). >> >> Tschöö >> >> Philipp
