The following discussion covers these topics:

Overview of systemd

Configuring MySQL Using systemd

Configuring Multiple MySQL Instances Using systemd

Migrating from mysqld_safe to systemd

Overview of systemd

systemd provides automatic server startup and shutdown. It also enables manual server management using the systemctl command. For example:

systemctl {start|stop|restart|status} mysqld
Alternatively, use the service command (with the arguments reversed), which is compatible with System V systems:

service mysqld {start|stop|restart|status}
For the systemctl or service commands, if the MySQL service name is not mysqld, use the appropriate name (for example, mysql on SLES systems).

Support for systemd includes these files:

mysqld.service: systemd service unit configuration, with details about the mysqld service.

mysqld@.service: Like mysqld.service, but used for managing multiple MySQL instances.

mysqld.tmpfiles.d: File containing information to support the tmpfiles feature. This file is installed under the name mysql.conf.

mysqld_pre_systemd: Support script for the unit file. This script assists in creating the error log file only if its location matches the pattern /var/log/mysql*.log. In other cases, the error log directory must be writable or the error log must be present and writable for the user running the mysqld process.

On platforms for which systemd support is installed, scripts such as mysqld_safe and the System V initialization script are not installed because they are unnecessary. For example, mysqld_safe can handle server restarts, but systemd provides the same capability, and does so in a manner consistent with management of other services rather than using an application-specific program.

As of MySQL 5.7.13, on platforms for which systemd support is installed, systemd has the capability of managing multiple MySQL instances. For details, see Configuring Multiple MySQL Instances Using systemd. Consequently, mysqld_multi and mysqld_multi.server are not installed because they are unnecessary.

Configuring MySQL Using systemd

To add or change systemd options for MySQL, these methods are available:

Use a localized systemd configuration file.

Arrange for systemd to set environment variables for the MySQL server process.

Set the MYSQLD_OPTS systemd variable.

To use a localized systemd configuration file, create the /etc/systemd/system/mysqld.service.d directory if it does not exist. In that directory, create a file that contains a [Service] section listing the desired settings. For example:

The discussion here uses override.conf as the name of this file. Newer versions of systemd support the following command, which opens an editor and permits you to edit the file:

systemctl edit mysqld
Whenever you create or change override.conf, reload the systemd configuration, then tell systemd to restart the MySQL service:

systemctl daemon-reload
systemctl restart mysqld
Support for configuration using override.conf was added in MySQL 5.7.7.

With systemd, the override.conf configuration method must be used for certain parameters, rather than settings in a [mysqld_safe] or [mysqld] group in a MySQL option file:

For some parameters, override.conf must be used because systemd itself must know their values and it cannot read MySQL option files to get them.

Parameters that specify values otherwise settable only using options known to mysqld_safe must be specified using systemd because there is no corresponding mysqld parameter.

For additional information about using systemd rather than mysqld_safe, see Migrating from mysqld_safe to systemd.

You can set the following parameters in override.conf:

To specify the process ID file:

As of MySQL 5.7.10: Use override.conf and change both PIDFile and ExecStart to name the PID file path name. Any setting of the process ID file in MySQL option files will be ignored.

Before MySQL 5.7.10: Use PIDFile in override.conf rather than the –pid-file option for mysqld_safe or mysqld. systemd must know the PID file location so that it can restart or stop the server. If the PID file value is specified in a MySQL option file, the value must match the PIDFile value or MySQL startup may fail.

To set the number of file descriptors available to the MySQL server, use LimitNOFILE in override.conf rather than the –open-files-limit option for mysqld_safe or mysqld.

To set the maximum core file size, use LimitCore in override.conf rather than the –core-file-size option for mysqld_safe.

To set the scheduling priority for the MySQL server, use Nice in override.conf rather than the –nice option for mysqld_safe.

Some MySQL parameters are configured using environment variables:

LD_PRELOAD: Set this variable if the MySQL server should use a specific memory-allocation library.

TZ: Set this variable to specify the default time zone for the server.

There are multiple ways to specify the value of environment values that should be in effect for the MySQL server process managed by systemd:

Use Environment lines in the override.conf file. For the syntax, see the example in the preceding discussion that describes how to use this file.

Specify the values in the /etc/sysconfig/mysql file (create the file if it does not exist). Assign values using the following syntax:

After modifying /etc/sysconfig/mysql, restart the server to make the changes effective:

systemctl restart mysqld
To specify options for mysqld without modifying systemd configuration files directly, set or unset the MYSQLD_OPTS systemd variable. For example:

systemctl set-environment MYSQLD_OPTS=”–general_log=1″
systemctl unset-environment MYSQLD_OPTS
After modifying the systemd environment, restart the server to make the changes effective:

systemctl restart mysqld
MYSQLD_OPTS can also be set in the /etc/sysconfig/mysql file.

Configuring Multiple MySQL Instances Using systemd

As of MySQL 5.7.13, on platforms for which systemd support is installed, systemd has the capability of managing multiple MySQL instances. Consequently, mysqld_multi and mysqld_multi.server are not installed because they are unnecessary.

To use multiple-instance capability, modify my.cnf to include configuration of key options for each instance. For example, to manage two instances named replica01 and replica02, add something like this to the file:


The replica names shown here use @ as the delimiter because that is the only delimiter supported by systemd.

Instances then are managed by normal systemd commands, such as:

systemctl start mysqld@replica01
systemctl start mysqld@replica02
To enable instances to run at boot time, do this:

systemctl enable mysqld@replica01
systemctl enable mysqld@replica02
Use of wildcards is also supported. For example, this command displays the status of all replica instances:

systemctl status ‘mysqld@replica*’
For management of multiple MySQL instances on the same machine, systemd automatically uses a different unit file (mysqld@.service rather than mysqld.service). In that unit file, %I and %i reference the parameter passed in after the @ marker and are used to manage the specific instance. For a command such as this:

systemctl start mysqld@mysql1
systemd starts the server using a command such as this:

mysqld –defaults-group-suffix=@%I …
The result is that the [server], [mysqld], and [mysqld@mysql1] option groups are read and used for that instance of the service.

Migrating from mysqld_safe to systemd

Because mysqld_safe is not installed when systemd is used, options previously specified for that program (for example, in an [mysqld_safe] option group) must be specified another way:

Some mysqld_safe options are also understood by mysqld and can be moved from the [mysqld_safe] option group to the [mysqld] group. This does not include –pid-file or –open-files-limit. To specify those options, use the override.conf systemd file, described previously.

For some mysqld_safe options, there are similar mysqld options. For example, the mysqld_safe option for enabling syslog logging is –syslog. For mysqld, enable the log_syslog system variable instead. For details, see Section 6.4.2, “The Error Log”.

mysqld_safe options not understood by mysqld can be specified in override.conf or environment variables. For example, with mysqld_safe, if the server should use a specific memory allocation library, this is specified using the –malloc-lib option. For installations that manage the server with systemd, arrange to set the LD_PRELOAD environment variable instead, as described previously.

发表于鸡鸡哥的聪明伶俐的儿子和如花似玉的老婆 | 留下评论

/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol ‘ber_strdup@@OPENLDAP_2.4_2’
/usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

make: *** [sapi/cli/php] Error 1


遇到这种类似的情况,说明「./configure 」沒抓好一些环境变数值。解决方法,来自老外的一篇文章:
在PHP源码目录下 vi Makefile 找到 EXTRA_LIBS 行,在行末添加 ‘ -llber ‘ 保存退出再次make即可。

发表于鸡鸡哥的聪明伶俐的儿子和如花似玉的老婆 | 留下评论



发表在 PHP | 留下评论

ubuntu16.04 任务栏不显示,桌面菜单右键无反应,无响应


1、任务栏不显示,metacity gnome的窗口管理器
apt install metacity
metacity –replace #运行一下就OK
2、gnome-tweak-tool Gnome Tweak Tool 是 Gnome 出品的配置工具,方便用户对 Gnome Shell 进行一些调整。
安装,更改 Gnome-shell 主题

发表在 一些经验 | 标签为 , , , | 留下评论



viMar 16 14:26:11 yanjin-Lenovo-G500 kernel: [ 922.570008] sogou-qimpanel[4689]: segfault at 361500 ip 00000000004fbedb sp 00007ffde42edc70 error 4 in sogou-qimpanel[400000+1c5000]
Mar 16 14:26:15 yanjin-Lenovo-G500 kernel: [ 927.290693] sogou-qimpanel[4910]: segfault at 3613c0 ip 00000000004fbedb sp 00007ffdb6b09510 error 4 in sogou-qimpanel[400000+1c5000]
Mar 16 14:26:23 yanjin-Lenovo-G500 kernel: [ 935.102633] sogou-qimpanel[5015]: segfault at 36c9b0 ip 00000000004fbedb sp 00007ffdd57b3e40 error 4 in sogou-qimpanel[400000+1c5000]

解决Ubuntu 16.04 搜狗输入法 只有悬浮窗中文不能自动联想的问题
rm -rf ~/.config/SogouPY* ~/.config/sogou*


发表在 一些经验 | 留下评论


Db::execute(‘insert into think_data (id, name ,status) values (?, ?, ?)’, [8, ‘thinkphp’, 1]);

Db::execute(‘insert into think_data (id, name , status) values (:id, :name, :status)’, [‘id’ => 10, ‘name’ => ‘thinkphp’, ‘status’ => 1]);

$result = Db::query(‘select * from think_data where id=:id’, [‘id’ => 10]);

$list = Db::name(‘data’)->where(‘id’,5)->select();

$db = db(‘data’);
$db->insert([‘id’ => 3, ‘name’ => ‘thinkphp’]);
$list = $db->where(‘id’,20)->select();

$list = Db::name(‘data’)->where(‘status’,1)->field(‘id,name’)->order(‘id’,’desc’)->limit(10)->select();

发表在 PHP | 标签为 , | 留下评论



ffmpeg -i music.ape music.wav

/usr/bin/ffmpeg -i /home/yanjin/music/wav/music.wav -af “pan=stereo|c0


发表在 其它 | 标签为 , , | 留下评论



hostname tcp:ip 不是写ip,这里写

# snmpd command line options
OPTIONS="tcp:1161 -LS0-6d -Lf /dev/null -p /var/run/"


发表在 一些经验 | 一条评论



Syntax: fastcgi_split_path_info regex;
Default: —
Context: location
Defines a regular expression that captures a value for the $fastcgi_path_info variable. The regular expression should have two captures: the first becomes a value of the $fastcgi_script_name variable, the second becomes a value of the $fastcgi_path_info variable. For example, with these settings

location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /path/to/php$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

and the “/show.php/article/0001” request, the SCRIPT_FILENAME parameter will be equal to “/path/to/php/show.php”, and the PATH_INFO parameter will be equal to “/article/0001”.

发表在 PHP | 留下评论



(PHP 4, PHP 5, PHP 7)

PHP 提供了一些流程控制的替代语法,包括 ifwhileforforeachswitch。替代语法的基本形式是把左花括号({)换成冒号(:),把右花括号(})分别换成 endif;endwhile;endfor;endforeach; 以及 endswitch;

<?php if ($a == 5): ?>
A is equal to 5
<?php endif; ?>

在上面的例子中,HTML 内容“A is equal to 5”用替代语法嵌套在 if 语句中。该 HTML 的内容仅在 $a 等于 5 时显示。

发表在 PHP | 留下评论