MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

存在这个问题的一般是由三个原因决定的:

1:配置中的一些文件权限不够,将所有的配置中涉及到的文件全部修改为mysql用户权限

2:mysql运行的pid没有,rm -rf /var/lock/subsys/mysql ,重新创建新的pid文件默认的权限为660

3:my.cnf配置文件错误,需要重新修改



Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

这个问题是由于myql存放文件中没有系统自带的数据库可以输入mysql_install_db

或者将数据库的路径重新修改为默认的/var/lib/mysql的目录下面


下面贴出我自己的mariadb的配置(从数据库)


[client]

port            = 3306

socket          = /var/lib/mysql/mysql.sock

default-character-set=utf8


[mysqld_safe]

socket          = /var/lib/mysql/mysql.sock

nice            = 0


[mysqld]

user  = mysql

pid-file  = /var/run/mysqld/mysqld.pid

socket  = /var/lib/mysql/mysql.sock

log_error  =  /var/log/mysqld/error.log

port  = 3306

basedir  = /usr

datadir  = /data

tmpdir  = /tmp

lc-messages-dir = /usr/share/mysql

skip-external-locking

bind-address = 0.0.0.0

skip-name-resolve 

lower_case_table_names = 1

max_connections = 1000

connect_timeout = 15

wait_timeout = 600

max_allowed_packet      = 16M

thread_cache_size       = 128

sort_buffer_size        = 16M

bulk_insert_buffer_size = 16M

tmp_table_size          = 128M

max_heap_table_size     = 128M

query_cache_limit     = 0

query_cache_size     = 0


long_query_time = 10


log_bin                 = /var/log/mysqld/mysql-bin

log_bin_index           = /var/log/mysqld/mysql-bin.index


expire_logs_days        = 10

max_binlog_size         = 100M


binlog_ignore_db=mysql

server_id=5005

log_slave_updates=1

slave_skip_errors=all

#auto_increment_offset=1

###auto_increment_increment=2

#binlog_format=row

#

##

##replicate-do-db=

#key_buffer_size = 1024M

##

#

#collation-server = utf8_general_ci

#init-connect='SET NAMES utf8'

#character-set-server = utf8

#

#default_storage_engine  = InnoDB

#innodb_buffer_pool_size = 30720M

#innodb_log_buffer_size  = 32M

#innodb_file_per_table   = 1

#innodb_open_files       = 400

#innodb_io_capacity      = 400

#innodb_flush_method     = O_DIRECT

#innodb_flush_log_at_trx_commit = 2

#innodb_log_file_size    = 512M

#

#key_buffer              = 16M

#thread_stack            = 192K

#myisam-recover         = BACKUP

#

#[mysqldump]

#quick

#quote-names

#max_allowed_packet      = 16M

#

#[isamchk]

#key_buffer              = 16M

##