修改mysql的端口,
https://sebhastian.com/mysql-default-port/
[root@$$$$$ mysql]# cat /etc/my.cnf # [client-server] # !includedir /etc/my.cnf.d [mysqld] skip-name-resolve port = XXX bind-address = 127.0.0.1 # mysqlx-bind-address = 127.0.0.1 |
其中的mysqlx-bind-address 是不能用的,因为我的数据库是 mariaDB
修改后 出错:
-- Unit mariadb.service has begun starting up. May 13 13:03:21 SL_BD_ZB_Svr mysql-prepare-db-dir[3062]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done. May 13 13:03:21 SL_BD_ZB_Svr mysql-prepare-db-dir[3062]: If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir. May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Note] /usr/libexec/mysqld (mysqld 10.3.17-MariaDB) starting as process 3101 ... May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 4183) May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Warning] Changed limits: max_open_files: 1024 max_connections: 151 (was 151) table_cache: 421 (was 2000) May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: mariadb.service: Main process exited, code=exited, status=7/NOTRUNNING May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: mariadb.service: Failed with result 'exit-code'. May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: Failed to start MariaDB 10.3 database server. -- Subject: Unit mariadb.service has failed |
参考:
修改了 vim /etc/systemd/system/multi-user.target.wants/Maria.service
增加了: LimitNOFILE=10000
vim /etc/zabbix/zabbix_server.conf DBPort = XXX |
再次重启发现了:
May 13 13:03:21 SL_BD_ZB_Svr mysql-prepare-db-dir[3062]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is May 13 13:03:21 SL_BD_ZB_Svr mysql-prepare-db-dir[3062]: If this is not the case, make sure the /var/lib/mysql is empty before running May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Note] /usr/libexec/mysqld (mysqld 10.3.17-MariaDB) starting as proces May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Warning] Could not increase number of max_open_files to more than 102 May 13 13:03:21 SL_BD_ZB_Svr mysqld[3101]: 2022-05-13 13:03:21 0 [Warning] Changed limits: max_open_files: 1024 max_connections: 151 ( May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: mariadb.service: Main process exited, code=exited, status=7/NOTRUNNING May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: mariadb.service: Failed with result 'exit-code'. May 13 13:03:23 SL_BD_ZB_Svr systemd[1]: Failed to start MariaDB 10.3 database server. |
发现没有明显报错,马上去找了 mysqld的日志文件:
[root@SL_BD_ZB_Svr mysql]# tail -f /var/log/mariadb/mariadb.log 2022-05-13 13:08:06 0 [Note] InnoDB: Waiting for purge to start 2022-05-13 13:08:06 0 [Note] InnoDB: 10.3.17 started; log sequence number 842423647265; transaction id 358552863 2022-05-13 13:08:06 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 2022-05-13 13:08:06 0 [Note] Plugin 'FEEDBACK' is disabled. 2022-05-13 13:08:06 0 [Warning] mysqld: GSSAPI plugin : default principal 'mariadb/sl_bd_zb_svr@' not found in keytab 2022-05-13 13:08:06 0 [ERROR] mysqld: Server GSSAPI error (major 851968, minor 2529639093) : gss_acquire_cred failed -Unspecified GSS failure. Minor code may provide more information. Keytab FILE:/etc/krb5.keytab is nonexistent or empty. 2022-05-13 13:08:06 0 [ERROR] Plugin 'gssapi' init function returned error. 2022-05-13 13:08:06 0 [ERROR] /usr/libexec/mysqld: unknown variable 'mysqlx-bind-address=127.0.0.1' 2022-05-13 13:08:06 0 [ERROR] Aborting |
在my.inf中注释后启动成功。
总结:
cat /etc/my.cnf vim /etc/zabbix/zabbix_server.conf systemctl restart mysqld vim /etc/systemd/system/multi-user.target.wants/Maria.service tail -f /var/log/mariadb/mariadb.log |