[mysqld_safe] 中的引數使用mysqld_safe命令啟動時不生效?
[mysqld_safe] 中的引數使用mysqld_safe命令啟動時不生效?
今天遇到一個現象,把引數寫在my.cnf的 [mysqld_safe]部分,但是引數卻沒有效果:
重現:
把max_connections=5寫在 [mysqld_safe]中:
[root@10-10-96-190 etc]# cat /etc/my.cnf
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/data/mysqld.log
pid-file=/data/mysqld.pid
使用mysqld_safe命令啟動mysql
[root@10-10-96-190 mysql-advanced-5.6.22-linux-glibc2.5-x86_64]# ./bin/mysqld_safe --defaults-file=/etc/my.cnf &
[1] 6102
[root@10-10-96-190 mysql-advanced-5.6.22-linux-glibc2.5-x86_64]# 150827 20:54:21 mysqld_safe Logging to '/data/mysqld.log'.
150827 20:54:21 mysqld_safe Starting mysqld daemon with databases from /data
[root@10-10-96-190 etc]# mysql -u root -S /data/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)
今天遇到一個現象,把引數寫在my.cnf的 [mysqld_safe]部分,但是引數卻沒有效果:
重現:
把max_connections=5寫在 [mysqld_safe]中:
[root@10-10-96-190 etc]# cat /etc/my.cnf
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/data/mysqld.log
pid-file=/data/mysqld.pid
使用mysqld_safe命令啟動mysql
[root@10-10-96-190 mysql-advanced-5.6.22-linux-glibc2.5-x86_64]# ./bin/mysqld_safe --defaults-file=/etc/my.cnf &
[1] 6102
[root@10-10-96-190 mysql-advanced-5.6.22-linux-glibc2.5-x86_64]# 150827 20:54:21 mysqld_safe Logging to '/data/mysqld.log'.
150827 20:54:21 mysqld_safe Starting mysqld daemon with databases from /data
[root@10-10-96-190 etc]# mysql -u root -S /data/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)
檢視文件可以知道,151是預設值:Default 151
這裡看的話,對於 在mysqld_safe中設定的max_connections=5是沒有效果的。
但是官方文件中寫到:
mysqld_safe reads all options from the [mysqld], [server], and [mysqld_safe] sections in option
files.
是可以讀到mysqld_safe部分的
是隻對這個max_connections這個引數沒有效果嗎?
經過嘗試之後slave_skip_errors 之後,發現這個引數也是沒有效果的。
但是對於log-error,pid-file 這兩個引數看起來是有效果的。
證實一下,把這兩個引數換個路徑。
[root@10-10-96-190 etc]# cat /etc/my.cnf
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/tmp/mysqld.log
pid-file=/tmp/mysqld.pid
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/tmp/mysqld.log
pid-file=/tmp/mysqld.pid
改好之後,重新啟動mysql
mysql> show variables like '%log_error%'
-> ;
+---------------------+-----------------+
| Variable_name | Value |
+---------------------+-----------------+
| binlog_error_action | IGNORE_ERROR |
| log_error | /tmp/mysqld.log |
+---------------------+-----------------+
2 rows in set (0.00 sec)
確實是有效果的。
那麼問題來了,對別的引數為什麼沒有效果。
通過對mysqld_safe的啟動過程進行跟蹤,發現了問題的所在。
解決方法:
在mysqld_safe的第234行加上
pick_args='1111'
然後再試一次:
[root@10-10-96-190 etc]# cat /etc/my.cnf
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/tmp/mysqld.log
pid-file=/tmp/mysqld.pid
slave_skip_errors=all
[mysqld]
datadir=/data
socket=/data/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
max_connections=5
log-error=/tmp/mysqld.log
pid-file=/tmp/mysqld.pid
slave_skip_errors=all
[root@10-10-96-190 etc]# mysql -u root -S /data/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%max_connection%'
-> ;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 5 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql> show variables like '%skip%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| skip_external_locking | ON |
| skip_name_resolve | OFF |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_skip_errors | ALL |
| sql_slave_skip_counter | 0 |
+------------------------+-------+
6 rows in set (0.00 sec)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%max_connection%'
-> ;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 5 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql> show variables like '%skip%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| skip_external_locking | ON |
| skip_name_resolve | OFF |
| skip_networking | OFF |
| skip_show_database | OFF |
| slave_skip_errors | ALL |
| sql_slave_skip_counter | 0 |
+------------------------+-------+
6 rows in set (0.00 sec)
這樣,他就使用到了[mysqld_safe]裡的內容
轉載請註明源出處
QQ 273002188 歡迎一起學習
QQ 群 236941212
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1784464/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysqld或mysqld_safe啟動時必須放在第一位的引數(first argument)MySql
- mysqld_safe和mysqldMySql
- mysqld和mysqld_safeMySql
- mysqld與mysqld_safeMySql
- 【Mysql學習】mysqld_safe:MySQL伺服器啟動指令碼MySql伺服器指令碼
- 【MySQL】mysql啟動報錯./mysqld_safe: my_print_defaults: not foundMySql
- 【Mysql 學習】mysqld_safe:MySQL伺服器啟動指令碼MySql伺服器指令碼
- Mysqld_safe支援選項MySql
- mysql配置檔案中mysqld_safe介紹MySql
- mysql關於mysqld_safe的總結MySql
- mysqld_safe之三言兩語MySql
- Mybatis動態傳入order by 引數的時候不生效的問題解決方案MyBatis
- 【MySQL】mysql啟動常見報錯 mysqld_safe mysqld from pid file hostname.pid endedMySql
- nginx命令:啟動,停止及命令引數詳解Nginx
- Mongodb啟動命令mongod引數說明MongoDB
- oracle啟動例項時使用引數檔案的順序Oracle
- 系統引數nofile設定不生效問題
- java 啟動命令 java -jar 如何追加引數JavaJAR
- 如何檢視docker run啟動引數命令Docker
- MongoDB Mongod啟動命令常用引數解釋MongoDB
- Starting MySQL * Couldn't find MySQL server (/usr/bin/mysqld_safe)MySqlServer
- MongoDB啟動命令mongod引數的詳細解釋MongoDB
- tar命令中--exclude引數使用詳解
- 如何使用kubelet 啟動命令限制Pod 啟動數量?
- java中的OutOfMemory設定jvm啟動引數JavaJVM
- Oracle對於啟動引數檢查不嚴格Oracle
- sqlplus在使用EOF時不顯示命令方法-引數-S靜默方式SQL
- Oracle引數修改後的生效判定Oracle
- Eclipse 的啟動引數Eclipse
- 關於動態使用keepAlive不生效的問題
- 我所使用的生產 Java 17 啟動引數Java
- kill命令中的processid引數
- Linux 中 RPM 命令引數使用詳解Linux
- java--jvm啟動的引數JavaJVM
- Chrome 啟動引數列表Chrome
- eclipse 啟動引數Eclipse
- Window中Oracle服務啟動時並不啟動例項的兩種方法Oracle
- (轉)Oracle中的啟動引數檔案:spfile和pfileOracle