Overview
When checking the status of the MySQL service, you could get the following error:
$ service mysql status
/etc/init.d/mysql: line 352: /dblgp/mysqldata/rm-lgp1.pid: Permission denied
MySQL is not running, but PID file exists [FAILED]
This article provides information on the root cause of this error and the resolution for it.
Root Cause
The reason why this error is encountered is running the service mysql status
command as the textpass user.
Resolution
In order not to get this error, the service mysql status
command should be executed as the root user.
Alternatively, you can also check if the MySQL process is running by using the following command as the textpass user:
$ ps -ef | grep -i sql
root 4344 1 0 May12 ? 00:00:00 /bin/sh /usr/local/bin/mysqld_safe --datadir=/dblgp/mysqldata --pid-file=/dblgp/mysqldata/rm-lgp1.pid
mysql 4835 4344 2 May12 ? 2-07:49:57 /usr/local/sbin/mysqld --basedir=/usr/local --datadir=/dblgp/mysqldata --plugin-dir=/usr/local/lib64/mysql/plugin --user=mysql --log-error=/dblgp/mysqldata/rm-lgp1.err --pid-file=/dblgp/mysqldata/rm-lgp1.pid --socket=/var/lib/mysql/mysql.sock --port=3306
textpass 7775 7445 0 10:06 pts/0 00:00:00 grep -i sql
Confirmation
When you execute the command as the root user or execute the alternative code as the textpass user, the MySQL process shows running.
# service mysql status
MySQL running (2327) [ OK ]
Supplemental Information
If the LGP node is working fine, you can also check if the MySQL process is running by using the following commands as the textpass user:
$ tp_status
PROCESS STATE UPTIME
tp_lgp operating 34 days, 6:21:10.61
tp_fclient operating (uptime not available)
tp_mgrd operating (uptime not available)
$ tp_walk -l lgpstatus
lgpActiveFlag.0 = INTEGER: true(1)
lgpIsMasterFlag.0 = INTEGER: true(1)
lgpLastCollection.0 = INTEGER: 1565595603
lgpQueueFiles.0 = Gauge32: 0
lgpQueueSize.0 = Gauge32: 0
lgpLoadRecs.0 = Gauge32: 0
lgpLoadBytes.0 = Gauge32: 0
lgpDbFiles.0 = Gauge32: 51748
lgpDbSize.0 = Gauge32: 49738241
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 79G 2.8G 72G 4% /
tmpfs 12G 8.0K 12G 1% /dev/shm
/dev/sda1 485M 45M 415M 10% /boot
/dev/sda5 79G 4.7G 71G 7% /var
/dev/sda6 92G 231M 87G 1% /var/TextPass
/dev/sdb 1.4T 102G 1.2T 8% /dblgp
To check if there is a table for the current date, execute the following command:
$ mysql -uroot -plokal$ lgp -e "show tables"
----------------------
Tables_in_lgp
----------------------
lgp_files
lgp_inb_msg_20190802
lgp_inb_msg_20190803
lgp_inb_msg_20190804
lgp_inb_msg_20190805
lgp_inb_msg_20190806
lgp_inb_msg_20190807
lgp_inb_msg_20190808
lgp_inb_msg_20190809
lgp_inb_msg_20190810
lgp_inb_msg_20190811
lgp_inb_msg_20190812
lgp_table_fts_status
----------------------
13 rows in set (0.00 sec)
To check if the collector is successfully running, execute the following command:
$ tail -f /var/log/messages
Aug 12 10:25:03 rm-lgp1 tp_lgp_collector[11588]: Running collection for user textpass
Aug 12 10:25:04 rm-lgp1 tp_lgp: COLLECTOR has successfully run
Aug 12 10:30:01 rm-lgp1 tp_lgp_master[12680]: Running master distribution for user textpass
Aug 12 10:30:02 rm-lgp1 tp_lgp: MASTER has successfully run
Aug 12 10:30:02 rm-lgp1 tp_lgp_collector[12690]: Running collection for user textpass
Aug 12 10:30:03 rm-lgp1 tp_lgp: COLLECTOR has successfully run