Reputation: 196
I am running mysql 5.5.22 on OSX Lion. My problem is mysqld_safe starts up and halts at the starting position like so.
I typed in this command: mysqld_safe
120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
The mysqld_safe program has been stalling at this last line of code for the 25 minutes now. Anyone have an idea? The google searches I've done revealed some issues with Lion but nothing on this particular issue.
Edit //
After reading the mysql error log, I discovered mysqldsafe could be already running indicated with this previous line of code:
120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
Is my assumption correct?
Here is the error log:
21 120327 11:21:58 mysqld_safe mysqld from pid file /usr/local/mysql/data/the- batmobile.pid ended
22 120327 11:23:06 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
23 120327 11:23:06 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
24 120327 11:23:06 [Note] Plugin 'FEDERATED' is disabled.
25 120327 11:23:06 InnoDB: The InnoDB memory heap is disabled
26 120327 11:23:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins
27 120327 11:23:06 InnoDB: Compressed tables use zlib 1.2.3
28 120327 11:23:06 InnoDB: Initializing buffer pool, size = 128.0M
29 120327 11:23:06 InnoDB: Completed initialization of buffer pool
30 120327 11:23:06 InnoDB: highest supported file format is Barracuda.
31 120327 11:23:06 InnoDB: Waiting for the background threads to start
32 120327 11:23:07 InnoDB: 1.1.8 started; log sequence number 1595675
33 120327 11:23:07 [Note] Event Scheduler: Loaded 0 events
34 120327 11:23:07 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
35 Version: '5.5.22' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
Upvotes: 4
Views: 6637
Reputation: 353
On Centos 7 - MariaDB, i had similar issue - mysqld_safe
stalled if used with &
or exited straight away without &
.
230505 20:40:48 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
230505 20:40:48 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql
My "fix" was to manually run mysqld
via mysql
user.
$ sudo -u mysql mysqld --skip-grant-tables --skip-networking &
[1] 19143
$ 2023-05-05 21:01:47 0 [Note] mysqld (mysqld 10.5.15-MariaDB) starting as process 19145 ...
[...]
2023-05-05 21:01:47 0 [Note] mysqld: ready for connections.
Version: '10.5.15-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 0 MariaDB Server
.. Run mysql sevrer root password reset as usual ...
Then kill server to restart.
$ sudo ps -aux | grep my
root 19143 0.0 0.1 241380 4660 pts/0 S 21:01 0:00 sudo -u mysql mysqld --skip-grant-tables --skip-networking
mysql 19145 0.0 2.9 1142176 115636 pts/0 Sl 21:01 0:00 mysqld --skip-grant-tables --skip-networking
$ sudo kill -9 19145
$ sudo service mariadb start
Upvotes: 0
Reputation: 4868
Your answer is correct -- that's how mysqld_safe is supposed to look. Glad you figured it out before going too crazy!
To stop mysql without having to manually kill it, you can use sudo mysqladmin shutdown
.
To start mysql without having a useless term window hanging around, you can use sudo mysqld_safe &
This causes mysqld to run in the background, and you can still use the term window. However, if you close the window it will also kill mysqld.
You should be able to make mysqld immune to dying when the window is closed by running nohup sudo mysqld_safe &
but that doesn't work for me (it starts in the background, but still dies when the window is closed). Not sure why.
Upvotes: 2
Reputation: 196
I think I found the answer to my own question!
When the command mysqld_safe is executed and no other line pops up after 'Starting daemon with dbs from /usr/local/mysql/data' it's working!
120327 05:33:57 mysqld_safe Logging to '/usr/local/mysql/data/The-BatMobile.local.err'.
120327 05:33:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
I did two tests to confirm this:
Test 1: mysqld_safe off
I killed the mysqld_safe process and tried to log in with "mysql -u root -p" and it gave me this error.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2):
Test 2: mysqld_safe: on
It works! I used "mysql -u root -p" to login and the mysql terminal popped up!
Upvotes: 4