Starting MySQL. mysqld
•
数据库
@[TOC](Mysql 启动报错并成功解决:Starting MySQL.2023-11-16T06:24:39.857506Z mysqld_safe error: log-error set to ‘/var/log/mariadb/mariadb.log’,however file don’t exists. Create writable for user ‘mysql’. The server quit without updating PID file (/var/lib/mysql/y[FAILED]d))

当我们启动MySQL数据库时,一直报错。。。。。。。。。。。。

在网上找了很多种方法都无法解决,终于…皇天不负有心人,终于让我嘚住啦!!!只需改一个文件就得吃啦!!!!!
查看mysql.server文件是否一致vim /usr/local/mysql/support-files/mysql.server

//复制文件并赋予权限 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld && chmod 755 /etc/init.d/mysqld
进入/etc/my.cnf,把里面的内容全部删除后直接全部复制下面内容进去,保存并退出,(前提是你信我哈,不太相信就提前cp my.cnf文件)
// 配置my.cnf vim /etc/my.cnf //删除原有的全部内容,然后复制下面内容,:wq保存并退出 [client] no-beep socket =/usr/local/mysql/mysql.sock # pipe # socket=0.0 port=3306 [mysql] default-character-set=utf8 [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data port=3306 pid-file=/usr/local/mysql/mysqld.pid #skip-grant-tables skip-name-resolve socket = /usr/local/mysql/mysql.sock character-set-server=utf8 default-storage-engine=INNODB explicit_defaults_for_timestamp = true # Server Id. server-id=1 max_connections=2000 query_cache_size=0 table_open_cache=2000 tmp_table_size=246M thread_cache_size=300 #限定用于每个数据库线程的栈大小。默认设置足以满足大多数应用 thread_stack = 192k key_buffer_size=512M read_buffer_size=4M read_rnd_buffer_size=32M innodb_data_home_dir = /usr/local/mysql/data innodb_flush_log_at_trx_commit=0 innodb_log_buffer_size=16M innodb_buffer_pool_size=256M innodb_log_file_size=128M innodb_thread_concurrency=128 innodb_autoextend_increment=1000 innodb_buffer_pool_instances=8 innodb_concurrency_tickets=5000 innodb_old_blocks_time=1000 innodb_open_files=300 innodb_stats_on_metadata=0 innodb_file_per_table=1 innodb_checksum_algorithm=0 back_log=80 flush_time=0 join_buffer_size=128M max_allowed_packet=1024M max_connect_errors=2000 open_files_limit=4161 query_cache_type=0 sort_buffer_size=32M table_definition_cache=1400 binlog_row_event_max_size=8K sync_master_info=10000 sync_relay_log=10000 sync_relay_log_info=10000 #批量插入数据缓存大小,可以有效提高插入效率,默认为8M bulk_insert_buffer_size = 64M interactive_timeout = 120 wait_timeout = 120 log-bin-trust-function-creators=1 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES # # include all files from the config directory # !includedir /etc/my.cnf.d
最后我们就来验证一下是否可以成功启动MySQL数据库并不会报错

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/a9321d1133.html
