Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket

Еverything happens for the first time ever.

Today, first time I have seen such MySQL service error during start: Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket.

First item to check: main MySQL service log /var/log/mysqld.log and main configuration file /etc/my.cnf

Then I have found nice KB article on Rackspace: http://kb.parallels.com/en/119334

It has helped me to solve this problem.

I have runned command to kill all possible running MySQL daemons:

# killall -9 mysqld_safe mysqld

And then I have made changes below to MySQL service startup script /etc/init.d/mysqld:

# cp -fv /etc/init.d/mysqld /etc/init.d/mysqld.orig
# diff -c /etc/init.d/mysqld.orig /etc/init.d/mysqld

+       # We check if there is already a process using the socket file,
+       # since otherwise this init script could report false positive
+       # result and mysqld_safe would remove the socket file, which
+       # actually uses a different daemon.
+       if fuser "$socketfile" &>/dev/null ; then
+           echo "Socket file $socketfile exists. Is another MySQL daemon already running with the same unix socket?"
+           action $"Starting $prog: " /bin/false
+           return 1
+       fi

-       if [ -S "$socketfile" ] ; then
-           echo "Another MySQL daemon already running with the same unix socket."
-           action $"Starting $prog: " /bin/false
-           return 1
-       fi

Then I have started MySQL server using command:

# /etc/init.d/mysqld start

There is another method to fix problems with MySQL server error:
Another MySQL daemon already running with the same unix socket

Run command:

# rm -fv $(grep socket /etc/my.cnf | cut -d= -f2) && /sbin/service mysqld start

Both of methods listed above has solved MySQL issues for me.

Plesk 11.0.9 for Linux: fix failed automatic update

If you can`t start Plesk 11.0.9 control panel for Linux using command:

# /sbin/service psa start

after failed automatic upgrade you can fix it using command:

# /usr/local/psa/bootstrapper/pp11.0.9-bootstrapper/bootstrapper.sh repair

Example commnad output:
Changing shell for popuser.
Shell not changed.
Changing shell for mhandlers-user.
Shell not changed.
===> Preparing upgrade
Stopping psa… done
psa is stopped
Stopping psa… done
===> Cumulative database upgrade has been started
===> Upgrade completed.
mknod: `/var/www/vhosts/chroot/dev/null’: File exists
===> Cumulative upgrade has been started
===> Upgrade completed.
Stopping psa… done
Starting xinetd service… done
Starting mysqld service… done
Starting named service… done
Starting postgresql service… not installed
Starting psa-spamassassin service… not installed
Plesk: Starting Mail Server… already started
Starting psa… done
Starting drwebd service… done

Congratulations!
All stages of the upgrade were successful.
psa is now running on your system.
To complete the system configuration process, please proceed to URL:
https://shkodenko.com:8443/ or
https://88.198.37.179:8443/
Use ‘admin’ and ‘‘ as login name and password.

Further, use the following commands to start and stop the system:
/etc/init.d/psa start and
/etc/init.d/psa stop respectively.

It should fix post-upgrade issues.
Related KB article: http://kb.parallels.com/en/116078

Warning during restart mysqld service Using unique option prefix pass instead of password is deprecated

If you getting
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.
during mysqld service restart you should fix your custom ~/.my.cnf configuration files syntax.

# more ~/.my.cnf
[client]
user=”root”
pass=”YourSecureMySQLPassword”
#

short “pass” should be removed by “password”:

password=”YourSecureMySQLPassword”

Plesk 11.5.30 for Linux post Update #26 error

During Plesk control panel version 11.5.30 for Linux when updated to #26 I got error:

ERROR: PleskFatalException: Unable to connect to database: mysql_connect(): No such file or directory (auth.php:142)

When I have checked KB articles related to this problem on suggested link Search for related Knowledge Base articles

I have found working solution:

# export PSA_PASSWORD='MySecurePleskPassword'
# echo $PSA_PASSWORD
MySecurePleskPassword
# /usr/local/psa/admin/bin/ch_admin_passwd

Drupal7 error 403 forbidden after log in from plain HTTP /user/login form

When I have set such settings in file sites/default/settings.php on one of my Drupal7 websites:

$base_url = 'https://shkodenko.com';  // NO trailing slash!
$conf['https'] = TRUE;

Users, after log in (if logged in from plain HTTP /user/login form) has started to see 403 forbidden error.
To fix it I have added such rules to main .htaccess file:

# Force SSL for user login
RewriteCond %{REQUEST_URI} ^/user/login
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

This has fixed the issue.

Linux Plesk PHP error: open_basedir restriction in effect

What is open_basedir ?

The open_basedir function defines the locations or paths from which PHP is allowed to access files using functions like fopen() , gzopen() , etc. If a file is outside of the paths defined by open_basdir setting, PHP will refuse to open it. You can’t use a symbolic link as a workaround, because the path that the symbolic link resolves to falls under the restrictions of the open_basedir function.

Note: The open_basedir restrictions can be turned off in the Apache configuration file e.g. httpd.conf, with the following lines:

<IfModule sapi_apache2.c>
php_admin_value open_basedir none
</IfModule>

If you have problems with Plesk control panel with virtual hosts on Linux servers if PHP error occured: open_basedir restriction in effect
you can create custom configuration file for virtual host to change default php_admin_value open_basedir value as shown in example below:

# more /var/www/vhosts/shkodenko.com/conf/vhost.conf 

<Directory /var/www/vhosts/shkodenko.com/httpdocs>
<IfModule sapi_apache2.c>
# php_admin_value open_basedir none
php_admin_value open_basedir “/var/www/vhosts/shkodenko.com/application:/var/www/vhosts/shkodenko.com/cache:/var/www/vhosts/shkodenko.com/httpdocs:/var/www/vhosts/shkodenko.com/library:/var/www/vhosts/shkodenko.com/tests”
</IfModule>
<IfModule mod_php5.c>
# php_admin_value open_basedir none
php_admin_value open_basedir “/var/www/vhosts/shkodenko.com/application:/var/www/vhosts/shkodenko.com/cache:/var/www/vhosts/shkodenko.com/httpdocs:/var/www/vhosts/shkodenko.com/library:/var/www/vhosts/shkodenko.com/tests”
</IfModule>
</Directory>
#

To check web server Apache configuration run command:

# /sbin/service httpd configtest

To add your custom virtual host configuration file /var/www/vhosts/shkodenko.com/conf/vhost.conf run command:

# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain shkodenko.com

To check if web server Apache configuration is OK run:

# /sbin/service httpd configtest

To restart web server Apache run:

# /sbin/service httpd graceful

Useful alias to backup and edit configuration file automatically

I’m using vim editor.

I have found useful alias to backup and edit configuration file automatically.
It can be added it to your ~/.bashrc

# User specific aliases and functions

conf() { [ "$1" != "" ] && cp -fvp "$1" "$1"-`date +%Y-%m-%d-%H-%M`.bak; vim "$1"; }

To apply newly created alias without restarting run:

# . ~/.bashrc

Usage example:

# conf /etc/httpd/conf/httpd.conf

It will create copy of /etc/httpd/conf/httpd.conf configuration file using pattern: /etc/httpd/conf/httpd.conf-YYYY-MM-DD.bak

To view your configuration changes you can run command:

# diff -Nau /etc/httpd/conf/httpd.conf-YYYY-MM-DD-HH-MM.bak /etc/httpd/conf/httpd.conf

Node Version Manager for Node.JS

If you need to install particular version of Node.JS (for example 0.10.12) wonderful Node Version Manager package can be used.

Automatic installation

# curl https://raw.github.com/creationix/nvm/master/install.sh | sh
or
# wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh

# nvm install v0.10.12
# nvm alias default 0.10.12
# node --version

Now, any Node.JS version can be installed and selected as default in system.

Install Node.JS with packages on CentOS, Fedora or any Redhat distros

I have started to develop using Node.JS on one of my projects.
To prepare Linux development server (on Fedora release 18 (Spherical Cow) as example) the following system packages has been installed (for my development purposes).
As root user:

 
# yum -y install 1:v8-3.14.5.10-2.fc18.x86_64 http-parser-2.0-3.20121128gitcd01361.fc18.x86_64 1:libuv-0.10.18-1.fc18.x86_64 nodejs-0.10.21-1.fc18.x86_64 nodejs-packaging-4-1.fc18.noarch 1:libuv-devel-0.10.18-1.fc18.x86_64 http-parser-devel-2.0-3.20121128gitcd01361.fc18.x86_64 1:v8-devel-3.14.5.10-2.fc18.x86_64 c-ares-devel-1.9.1-2.fc18.x86_64 nodejs-devel-0.10.21-1.fc18.x86_64 nodejs-inherits-2.0.0-4.fc18.noarch nodejs-hoek-0.9.1-1.fc18.noarch nodejs-boom-0.4.2-2.fc18.noarch nodejs-mkdirp-0.3.5-3.fc18.noarch nodejs-mime-1.2.11-1.fc18.noarch nodejs-graceful-fs-2.0.0-2.fc18.noarch nodejs-rimraf-2.2.2-1.fc18.noarch nodejs-fstream-0.1.24-1.fc18.noarch nodejs-cryptiles-0.2.2-1.fc18.noarch nodejs-sntp-0.2.4-1.fc18.noarch nodejs-hawk-1.0.0-1.fc18.noarch nodejs-block-stream-0.0.7-1.fc18.noarch nodejs-tar-0.1.18-1.fc18.noarch nodejs-aws-sign-0.3.0-1.fc18.noarch nodejs-qs-0.6.5-3.fc18.noarch nodejs-asn1-0.1.11-3.fc18.noarch nodejs-abbrev-1.0.4-6.fc18.noarch nodejs-nopt-2.1.2-1.fc18.noarch nodejs-tunnel-agent-0.3.0-1.fc18.noarch nodejs-semver-2.1.0-1.fc18.noarch 1:nodejs-cookie-jar-0.3.0-1.fc18.noarch nodejs-assert-plus-0.1.4-1.fc18.noarch nodejs-sigmund-1.0.0-5.fc18.noarch nodejs-osenv-0.0.3-5.fc18.noarch nodejs-which-1.0.5-8.fc18.noarch nodejs-node-uuid-1.4.1-1.fc18.noarch nodejs-lru-cache-2.3.0-3.fc18.noarch nodejs-minimatch-0.2.12-2.fc18.noarch nodejs-glob-3.2.6-1.fc18.noarch nodejs-ctype-0.5.3-3.fc18.noarch nodejs-http-signature-0.10.0-3.fc18.noarch nodejs-json-stringify-safe-5.0.0-1.fc18.noarch nodejs-oauth-sign-0.3.0-1.fc18.noarch nodejs-forever-agent-0.5.0-1.fc18.noarch gyp-0.1-0.10.1617svn.fc18.noarch nodejs-async-0.2.9-2.fc18.noarch nodejs-ansi-0.2.1-1.fc18.noarch nodejs-npmlog-0.0.4-1.fc18.noarch nodejs-delayed-stream-0.0.5-5.fc18.noarch nodejs-combined-stream-0.0.4-3.fc18.noarch nodejs-form-data-0.1.1-1.fc18.noarch nodejs-request-2.25.0-3.fc18.noarch node-gyp-0.10.6-2.fc18.noarch nodejs-proto-list-1.2.2-5.fc18.noarch nodejs-ini-1.1.0-3.fc18.noarch nodejs-config-chain-1.1.7-1.fc18.noarch nodejs-couch-login-0.1.18-1.fc18.noarch nodejs-archy-0.0.2-8.fc18.noarch nodejs-chownr-0.0.1-9.fc18.noarch nodejs-chmodr-0.1.0-4.fc18.noarch nodejs-inherits1-1.0.0-11.fc18.noarch nodejs-slide-1.1.5-1.fc18.noarch nodejs-fstream-ignore-0.0.7-1.fc18.noarch nodejs-once-1.1.1-5.fc18.noarch nodejs-mute-stream-0.0.4-1.fc18.noarch nodejs-read-1.0.5-1.fc18.noarch nodejs-promzard-0.2.0-6.fc18.noarch nodejs-github-url-from-git-1.1.1-2.fc18.noarch nodejs-normalize-package-data-0.2.1-1.fc18.noarch nodejs-read-package-json-1.1.3-1.fc18.noarch nodejs-retry-0.6.0-5.fc18.noarch nodejs-npm-registry-client-0.2.28-1.fc18.noarch nodejs-read-installed-0.2.4-1.fc18.noarch nodejs-init-package-json-0.0.10-1.fc18.noarch nodejs-npmconf-0.1.2-1.fc18.noarch nodejs-fstream-npm-0.1.5-1.fc18.noarch nodejs-uid-number-0.0.3-7.fc18.noarch nodejs-opener-1.3.0-7.fc18.noarch nodejs-lockfile-0.4.2-1.fc18.noarch nodejs-npm-user-validate-0.0.3-1.fc18.noarch nodejs-child-process-close-0.1.1-2.fc18.noarch nodejs-editor-0.0.4-2.fc18.noarch nodejs-sha-1.2.1-1.fc18.noarch nodejs-cmd-shim-1.1.0-3.fc18.noarch npm-1.3.6-4.fc18.noarch libicu-devel-49.1.1-12.fc18.x86_64

As web developer user:

 
# cd /var/www/vhosts/nodejs_app/
# npm install node-stringprep
# whereis node
node: /bin/node /usr/bin/node /usr/include/node /usr/share/node /usr/share/man/man1/node.1.gz

To run Node.JS application:

# /usr/bin/node www/app.js