mysql service reappears after kill -9 <pid for mysql> - mysql

I have mysql installed on Ubuntu18.04. I tried to kill the mysql process with kill -9 but it comes back immediately. Here's example from my terminal output:
root#mysql-image:~# ps aux | grep mysql
mysql 779 0.8 19.2 1166336 188064 ? Sl 20:06 0:02 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
root 1046 0.0 0.1 13144 1060 pts/0 S+ 20:11 0:00 grep --color=auto mysql
root#mysql-image:~# kill -9 779
root#mysql-image:~# ps aux | grep mysql
mysql 1063 21.5 18.1 1165936 177556 ? Sl 20:11 0:00 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
root 1094 0.0 0.1 13144 1032 pts/0 S+ 20:11 0:00 grep --color=auto mysql
root#mysql-image:~# kill -9 1063
root#mysql-image:~# ps aux | grep mysql
mysql 1142 21.5 18.1 1165936 177628 ? Sl 20:12 0:00 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
root 1173 0.0 0.1 13144 1084 pts/0 S+ 20:12 0:00 grep --color=auto mysql
I'm trying to destroy the mysql process in an abrupt way and "unsafe way" as part of an experiment I'm doing. But the kill -9 doesn't seem to permanently shut down the mysql database.
What am I doing wrong?

Normally, systemd will be configured to restart mysql if it unexpectedly terminates, with Restart=on-abort in /usr/lib/systemd/system/mysql.service.
on-abort is explained in: https://unix.stackexchange.com/questions/564443/what-does-restart-on-abort-mean-in-a-systemd-service
You could try making a change to the mysql conf files that keep it from restarting (setting a non-existent user, maybe?). Or you can just do a
kill -15 instead, which is treated as an expected termination so won't cause a restart.

Related

User process shadows mysqld service, how do I find the bad command?

Kubuntu 17
When I login and do "ps -ef | grep mysqld" I see two copies running, one as the system service daemon, and one as a user process.
ps -ef | grep mysqld
mysql 1953 1 0 09:02 ? 00:00:13 /usr/sbin/mysqld
richard 3233 3220 0 09:13 ? 00:00:35 /usr/sbin/mysqld --
defaults-file=/home/richard/.local/share/akonadi/mysql.conf --
datadir=/home/richard/.local/share/akonadi/db_data/ --
socket=/tmp/akonadi-richard.EK3Z9U/mysql.socket
richard 13309 3138 0 18:05 pts/1 00:00:00 grep --color=auto
mysqld
I don't see any script or command with "mysqld" in ~/.profle, ~/.autostart, ~/.bashrc, /etc/profile, /etc/init.d (except for the mysql start script presumably used by the system and owned by root.
Where else should I look for the errant command?
Any great ideas on how to look for it effectively?

How to connect with AWS mysql server using commandline?

I am new to AWS EC2 and I wanted to connect the Mysql to upload an sql file.
I used bitvize sftp to upload the files and with this ftp i have a commandline window to work around the server.
Here i am trying to connect the mysql using commands like -
Verify that mysql server is up and running first by a 'ps -ef | grep mysql'
ec2-user 22352 254217 0 10:58 pts/0 00:00:00 grep --color=auto mysql
root 223349 1 0 2016 ? 00:00:00 /bin/sh /usr/libexec/mysql55/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql 223349 226349 0 2016 ? 00:33:26 /usr/libexec/mysql55/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
Then i tried the command /usr/bin/mysql -uroot -p
it prompts the password.But i don't know the password or am i doing the correct method?
The bottom line is i need to create a db and user and upload an sql file for that DB.
How could i do it?
If the root user doesn't have a password, then don't use the -p option.

mysql 5.1.59 won't start on Mac OS 10.7 at startup

When I reboot, mysql 5.1.59 is not running despite Activity Monitor showing 2 mysql PIDs. IF I quit the 2 mysql instances, I am able to startup mysql in Webmin (working PID is 3735, see below).
When I run this in Terminal: ps axu | grep mysql
I get:
root 3261 0.0 0.0 2435492 932 ?? Ss 9:52AM 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql
admin1 3843 0.0 0.0 2435492 348 s000 R+ 9:56AM 0:00.00 grep mysql
_mysql 3735 0.0 0.3 2522936 13680 ?? S 9:53AM 0:00.04 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --log-error=/usr/local/mysql/data/macpro.local.err --pid-file=/usr/local/mysql/data/macpro.local.pid --socket=/tmp/mysql.sock --port=3306
Why do there seem to be 3 instances (3 users) here?
I assumed that my file:
com.mysql.mysql.plist
in
Library/LaunchDaemons
would be the only method that mysql launches at startup. I do not use the mysql PrefPane (never worked anyway), nor are there any mysql items in Library/StartupItems.
Any help would be great. Thanks!

MySQL deactivated in Lampp, Xampp on Linux 12.04

I have freshly installed xampp-linux-1.8.1 on my Ubuntu 12.04 (Mint 13 maya) Operating system.
When run lampp, I get :
/opt/lampp/lampp start
Starting XAMPP for Linux 1.8.1...
XAMPP: XAMPP-Apache is already running.
XAMPP: Another MySQL daemon is already running.
XAMPP: XAMPP-ProFTPD is already running.
XAMPP for Linux started.
In the : localhost/xampp/
MySQL DataBase is Deactivated !!!
ps -aux | grep 'mysql'
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html mysql 3159 0.0 0.9 316264 31880 ? Ssl 16:48 0:00 /usr/sbin/mysqld
root 4745 0.0 0.0 4648 840 pts/5 S+ 17:02 0:00 grep --color=auto mysql
When I tried to stop /usr/sbin/mysqld but it can't be stopped with this command !!!
/usr/sbin/mysqld stop
Please I need Help, Thanks.
i've resolved the issue in this way:
sudo chmod -R 777 /opt/lampp
sudo chown -hR nobody /opt/lampp
sudo chmod -R 755 /opt/lampp
then stop other mysqld running with:
sudo service mysql stop
Also had this issue, after troubleshooting for almost 2 hours I found that it was because of other Apache and MySQL packages also running on my system. Removed all Apache and MySQL packages and reinstalled XAMPP again. Success.

Couchbase restore error

server system: Ubuntu 10.04.2
Couchbase: 1.8.1
python: 2.7.3
back files: cbbackup ./default-data/default /data/Couchbase_backups/default_20120705
restore: cbrestore -a default_20120705/default*
root#945f14b6-3015-4dac-b486-a8914a3f553d:~# cbrestore -a /data/Couchbase_backups/default_20120706/defaults*
Error on key 'sk_deviceHistory_F118C61C-8B30-4667-A7E2-2959836734BD': Memcached error #32: Auth failure
Error on key 'sk_deviceHistory_F118C61C-8B30-4667-A7E2-2959836734BD': Memcached error #32: Auth failure
Error on key 'sk_deviceHistory_F118C61C-8B30-4667-A7E2-2959836734BD': Memcached error #32: Auth failure
Error on key 'sk_deviceHistory_F118C61C-8B30-4667-A7E2-2959836734BD': Memcached error #32: Auth failure
^Z
[1]+ Stopped cbrestore -a /data/Couchbase_backups/default_20120706/defaults*
root#945f14b6-3015-4dac-b486-a8914a3f553d:~# ps -ef|grep python
root 711 512 1 15:46 pts/2 00:00:00 python /opt/couchbase/lib/python/cbrestore -a /data/Couchbase_backups/default_20120706/defaults /data/Couchbase_backups/default_20120706/defaults-0.mb /data/Couchbase_backups/default_20120706/defaults-1.mb /data/Couchbase_backups/default_20120706/defaults-2.mb /data/Couchbase_backups/default_20120706/defaults-3.mb
root 726 512 0 15:46 pts/2 00:00:00 grep --color=auto python
root#945f14b6-3015-4dac-b486-a8914a3f553d:~# kill -9 711
root#945f14b6-3015-4dac-b486-a8914a3f553d:~# ps -ef|grep python
root 729 512 0 15:47 pts/2 00:00:00 grep --color=auto python
[1]+ Killed cbrestore -a /data/Couchbase_backups/default_20120706/defaults*
root#945f14b6-3015-4dac-b486-a8914a3f553d:~# ps -ef|grep python
root 731 512 0 15:47 pts/2 00:00:00 grep --color=auto python
root#945f14b6-3015-4dac-b486-a8914a3f553d:~#
have you tried the -u BUCKET_NAME and -p BUCKET_PASSWORD parameters? That way the cbrestore tool can successfully authenticate to the right bucket?
For more flag and usage, also, there's also the -h / --help parameter.
sudo ./cbbackup HOST:PORT ~/Documents/ -u ‘username’ -p ‘password‘ -b BUCKET_NAME
This works for me.