7stud
7stud

Reputation: 48589

mariadb server: I can't stop the server with `mysql.server stop`

OSX 10.13.6

I installed mariadb sever with homebrew a few years ago, and I use it infrequently. Today, I tried to start mariadb using the command:

$ mysql.server start

and I got a bunch of errors. So, I did:

$ brew update

then:

$ brew uprade mariadb

That completed fine, and now I can start mariadb with:

$ mysql.server start

and I can access all my old db's.

The problem I'm having is that I cannot stop mysql. Both these commands hang:

$ mysql.server stop

and(in another terminal window):

$ mysql.server status

According to the MariaDB docs for mysql.server, both those commands should work.

Currently, I'm killing the server like this:

$ killall mysqld mysqld_safe

then checking that the server was killed with this:

$ ps aux | grep mysqld

When I run the ps command when mysql is running, I get:

~$ ps aux | grep mysqld
7stud 3707 0.0 1.0 4808208 79948 s005 S 1:26PM 0:00.47
/usr/local/Cellar/mariadb/10.3.15/bin/mysqld --basedir=/usr/local/Cellar/mariadb/10.3.15 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mariadb/10.3.15/lib/plugin --log-error=/usr/local/var/mysql/My-MacBook-Pro-2.local.err --pid-file=/usr/local/var/mysql/My-MacBook-Pro-2.local.pid

7stud 3643 0.0 0.0 4287792 1460 s005 S 1:26PM 0:00.02 /bin/sh /usr/local/Cellar/mariadb/10.3.15/bin/mysqld_safe --datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/My-MacBook-Pro-2.local.pid

7stud 4544 0.0 0.0 4267752 880 s000 S+ 1:41PM 0:00.00
grep mysqld

What is the proper way to shut down the mariadb server?

mysql> SHOW VARIABLES LIKE '%vers%';
+---------------------------------+------------------------------------------+
| Variable_name                   | Value                                    |
+---------------------------------+------------------------------------------+
| innodb_version                  | 10.3.15                                  |
| protocol_version                | 10                                       |
| slave_type_conversions          |                                          |
| system_versioning_alter_history | ERROR                                    |
| system_versioning_asof          | DEFAULT                                  |
| thread_pool_oversubscribe       | 3                                        |
| version                         | 10.3.15-MariaDB                          |
| version_comment                 | Homebrew                                 |
| version_compile_machine         | x86_64                                   |
| version_compile_os              | osx10.13                                 |
| version_malloc_library          | system                                   |
| version_source_revision         | 07aef9f7eb936de2b277f8ae209a1fd72510c011 |
| version_ssl_library             | OpenSSL 1.0.2r  26 Feb 2019              |
| wsrep_patch_version             | wsrep_25.24                              |
+---------------------------------+------------------------------------------+
14 rows in set (0.01 sec)

Upvotes: 6

Views: 7832

Answers (2)

sunknudsen
sunknudsen

Reputation: 7220

See https://stackoverflow.com/a/59938033/4579271 for details.

To fix, run:

cp /usr/local/bin/mysql.server /usr/local/bin/mysql.server.backup
sed -i "" "s/user='mysql'/user=\`whoami\`/g" /usr/local/bin/mysql.server

Upvotes: 7

Omarchh
Omarchh

Reputation: 101

I had the same issue, tried to use mysql.server stop and mysql.server status after running mysql.server start but they will just run indefinitely.

If you are using a Mac seems that mysql.server stop won't work... I installed mariadb with homebrew and found out that I can use brew services to start and stop it in this link:

https://dba.stackexchange.com/questions/214883/homebrew-mariadb-server-start-error-with-mysql-server-start

The commands are pretty simple and they work for me

brew services start mariadb
brew services stop mariadb

It may be a little late but I hope this helps you to figure out your problem.

Upvotes: 8

Related Questions