‘无法通过套接字‘/path/mysql/mysqld.sock’连接到本地 MySQL 服务器(2“没有此文件或目录”)’

‘无法通过套接字‘/path/mysql/mysqld.sock’连接到本地 MySQL 服务器(2“没有此文件或目录”)’

在我更改了 MariaDB(Ubuntu 16.04)的数据目录后,我无法再重新启动 mysql。

我更改了文件中数据目录的路径/etc/my.cnf。但是,如果我尝试使用 启动 MariaDB sudo /etc/init.d/mysql start ,则会收到以下错误:

mysql[13985]: Fatal error in defaults handling. Program aborted   
/etc/init.d/mysql[14385]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[14385]: [61B blob data]
/etc/init.d/mysql[14385]: error: 'Can't connect to local MySQL server through socket '/path/mysql/mysqld.sock' (2 "No such file or directory")'
/etc/init.d/mysql[14385]: Check that mysqld is running and that the socket: '/path/mysql/mysqld.sock' exists!
mysql[13985]:    ...fail!

文件 my.cnf 如下所示:

#The MariaDB server
[mysqld]
socket=/path/mysql/mysqld.sock
datadir=/path/mysql
bind-address = localhost

[client]
port=3306
socket=/path/mysql/mysqld.sock

该文件/path/mysqld.sock不存在,但我已授予该文件夹权限。

我该如何设法重新启动 mysql?

编辑1:现在我还另外收到了这些错误:

[ERROR] mysqld: Can't create/write to file '/MariaDBData/aria_log_control' (Errcode: 13 "Permission denied")
[ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/MariaDBData/aria_log_control'
[ERROR] Plugin 'Aria' init function returned error.
[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.

编辑2:现在我仅用于/etc/mysql/mariadb.conf.d/50-server.cnf更改配置。这些是基本设置:

# * Basic Settings
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /.../MariaDBData
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

编辑3:输出ls -lht /.../MariaDBData/*ls -lhtd /MariaDBData

root@Server:~# ls -lht /.../MariaDBData/*
-rwxrwxrwx 1 server server 12M Oct  9 15:39 /.../MariaDBData/ibdata1
-rwxrwxrwx 1 server server 48M Oct  9 15:39 /.../MariaDBData/ib_logfile0
-rwxrwxrwx 1 server server 191 Oct  9 15:36 /.../MariaDBData/Server.log
-rwxrwxrwx 1 server server 48M Oct  9 15:35 /.../MariaDBData/ib_logfile1

root@Server:~# ls -lhtd /.../MariaDBData
drwxrwxrwx 1 server server 4.0K Oct  9 15:39 /.../MariaDBData

编辑4:输出journalctl -xesystemctl status mysql.service

journalctl -xe

Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool siz
Oct 09 15:39:26 Server mysqld[3912]: 
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Using mutexes to ref count buffer pool pages
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: The InnoDB memory heap is disabled
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Compressed tables use zlib 1.2.8
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Using Linux native AIO
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Using CPU crc32 instructions
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Initializing buffer pool, size = 128.0M
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Completed initialization of buffer pool
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Highest supported file format is Barracuda.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: 128 rollback segment(s) are active.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Waiting for purge to start
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1600617
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] Plugin 'FEEDBACK' is disabled.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [ERROR] Aria engine is not enabled or did not start. The Aria engine must be enabled to continue as mysqld 
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [ERROR] Aborting
Oct 09 15:39:26 Server mysqld[3912]: 
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: FTS optimize thread exiting.
Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Starting shutdown...
Oct 09 15:39:27 Server mysqld[3912]: 181009 15:39:27 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
Oct 09 15:39:29 Server mysqld[3912]: 181009 15:39:29 [Note] InnoDB: Shutdown completed; log sequence number 1600627
Oct 09 15:39:29 Server mysqld[3912]: 181009 15:39:29 [Note] /usr/sbin/mysqld: Shutdown complete
Oct 09 15:39:29 Server mysqld[3912]: 
Oct 09 15:39:29 Server mysqld_safe[3968]: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Oct 09 15:39:56 Server /etc/init.d/mysql[4251]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Oct 09 15:39:56 Server /etc/init.d/mysql[4251]: [61B blob data]
Oct 09 15:39:56 Server /etc/init.d/mysql[4251]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or dir
Oct 09 15:39:56 Server mysql[3628]:    ...fail!
Oct 09 15:39:56 Server /etc/init.d/mysql[4251]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Oct 09 15:39:56 Server /etc/init.d/mysql[4251]: 
Oct 09 15:39:56 Server systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 09 15:39:56 Server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysql.service has failed.
-- 
-- The result is failed.
Oct 09 15:39:56 Server systemd[1]: mysql.service: Unit entered failed state.
Oct 09 15:39:56 Server systemd[1]: mysql.service: Failed with result 'exit-code'.
Oct 09 15:39:56 Server sudo[3532]: pam_unix(sudo:session): session closed for user root
Oct 09 15:41:20 Server sudo[4294]:     root : TTY=pts/2 ; PWD=/root ; USER=root ; COMMAND=sudoedit /etc/mysql/mariadb.conf.d/50-server.cnf
Oct 09 15:41:20 Server sudoedit[4294]: pam_unix(sudo:session): session opened for user root by (uid=0)
Oct 09 15:43:46 Server sudoedit[4294]: pam_unix(sudo:session): session closed for user root
Oct 09 15:44:31 Server sudo[4311]:     root : TTY=pts/2 ; PWD=/root ; USER=root ; COMMAND=sudoedit /etc/mysql/mariadb.conf.d/50-server.cnf
Oct 09 15:44:31 Server sudoedit[4311]: pam_unix(sudo:session): session opened for user root by (uid=0)
Oct 09 15:45:55 Server sudoedit[4311]: pam_unix(sudo:session): session closed for user root

systemctl status mysql.service

mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-10-09 15:39:56 CEST; 15min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3560 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 3628 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Oct 09 15:39:26 Server mysqld[3912]: 181009 15:39:26 [Note] InnoDB: Starting shutdown...
Oct 09 15:39:27 Server mysqld[3912]: 181009 15:39:27 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
Oct 09 15:39:29 Server mysqld[3912]: 181009 15:39:29 [Note] InnoDB: Shutdown completed; log sequence number 1600627
Oct 09 15:39:29 Server mysqld[3912]: 181009 15:39:29 [Note] /usr/sbin/mysqld: Shutdown complete
Oct 09 15:39:29 Server mysqld[3912]: 
Oct 09 15:39:56 Server mysql[3628]:    ...fail!
Oct 09 15:39:56 Server systemd[1]: mysql.service: Control process exited, code=exited status=1
Oct 09 15:39:56 Server systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Oct 09 15:39:56 Server systemd[1]: mysql.service: Unit entered failed state.
Oct 09 15:39:56 Server systemd[1]: mysql.service: Failed with result 'exit-code'.

编辑5:使用 ext3 文件格式(而不是 NTFS)后的权限和错误消息

ls -lhtd /media/server/MariaDB
drwxrwxr-x 4 mysql mysql 4.0K Oct 10 15:34 /media/server/MariaDB

ls -lht /media/server/MariaDB/*
-rw-rw---- 1 mysql mysql  16K Oct 10 15:31 /media/server/MariaDB/aria_log.00000001
-rw-rw---- 1 mysql mysql   52 Oct 10 15:31 /media/server/MariaDB/aria_log_control
-rw-rw---- 1 mysql mysql  12M Oct 10 15:31 /media/server/MariaDB/ibdata1
-rw-rw---- 1 mysql mysql  48M Oct 10 15:31 /media/server/MariaDB/ib_logfile0
-rw-rw---- 1 mysql mysql  48M Oct 10 15:21 /media/server/MariaDB/ib_logfile1

/media/server/MariaDB/performance_schema:
total 216K
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 session_account_connect_attrs.frm
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 session_connect_attrs.frm
-rw-rw---- 1 mysql mysql 1.9K Oct 10 15:21 events_statements_summary_by_digest.frm
-rw-rw---- 1 mysql mysql  781 Oct 10 15:21 accounts.frm
-rw-rw---- 1 mysql mysql  579 Oct 10 15:21 users.frm
-rw-rw---- 1 mysql mysql  711 Oct 10 15:21 hosts.frm
-rw-rw---- 1 mysql mysql 1.9K Oct 10 15:21 events_statements_summary_global_by_event_name.frm
-rw-rw---- 1 mysql mysql 2.1K Oct 10 15:21 events_statements_summary_by_account_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.9K Oct 10 15:21 events_statements_summary_by_user_by_event_name.frm
-rw-rw---- 1 mysql mysql 2.1K Oct 10 15:21 events_statements_summary_by_host_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.9K Oct 10 15:21 events_statements_summary_by_thread_by_event_name.frm
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 events_statements_history_long.frm
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 events_statements_history.frm
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 events_statements_current.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_stages_summary_global_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.3K Oct 10 15:21 events_stages_summary_by_account_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_stages_summary_by_user_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.3K Oct 10 15:21 events_stages_summary_by_host_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_stages_summary_by_thread_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.4K Oct 10 15:21 events_stages_history_long.frm
-rw-rw---- 1 mysql mysql 1.4K Oct 10 15:21 events_stages_history.frm
-rw-rw---- 1 mysql mysql 1.4K Oct 10 15:21 events_stages_current.frm
-rw-rw---- 1 mysql mysql 2.2K Oct 10 15:21 threads.frm
-rw-rw---- 1 mysql mysql 4.4K Oct 10 15:21 table_lock_waits_summary_by_table.frm
-rw-rw---- 1 mysql mysql 2.5K Oct 10 15:21 table_io_waits_summary_by_table.frm
-rw-rw---- 1 mysql mysql 2.7K Oct 10 15:21 table_io_waits_summary_by_index_usage.frm
-rw-rw---- 1 mysql mysql  712 Oct 10 15:21 setup_timers.frm
-rw-rw---- 1 mysql mysql  964 Oct 10 15:21 setup_objects.frm
-rw-rw---- 1 mysql mysql  887 Oct 10 15:21 setup_instruments.frm
-rw-rw---- 1 mysql mysql  670 Oct 10 15:21 setup_consumers.frm
-rw-rw---- 1 mysql mysql  763 Oct 10 15:21 setup_actors.frm
-rw-rw---- 1 mysql mysql  969 Oct 10 15:21 rwlock_instances.frm
-rw-rw---- 1 mysql mysql  621 Oct 10 15:21 performance_timers.frm
-rw-rw---- 1 mysql mysql 1.3K Oct 10 15:21 objects_summary_global_by_type.frm
-rw-rw---- 1 mysql mysql  921 Oct 10 15:21 mutex_instances.frm
-rw-rw---- 1 mysql mysql 2.7K Oct 10 15:21 host_cache.frm
-rw-rw---- 1 mysql mysql 1.7K Oct 10 15:21 socket_summary_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.8K Oct 10 15:21 socket_summary_by_instance.frm
-rw-rw---- 1 mysql mysql 1.2K Oct 10 15:21 socket_instances.frm
-rw-rw---- 1 mysql mysql 3.3K Oct 10 15:21 file_summary_by_instance.frm
-rw-rw---- 1 mysql mysql 1.7K Oct 10 15:21 file_summary_by_event_name.frm
-rw-rw---- 1 mysql mysql 2.4K Oct 10 15:21 file_instances.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_waits_summary_global_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_waits_summary_by_thread_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.3K Oct 10 15:21 events_waits_summary_by_account_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_waits_summary_by_user_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.3K Oct 10 15:21 events_waits_summary_by_host_by_event_name.frm
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 events_waits_summary_by_instance.frm
-rw-rw---- 1 mysql mysql 3.8K Oct 10 15:21 events_waits_history_long.frm
-rw-rw---- 1 mysql mysql 3.8K Oct 10 15:21 events_waits_history.frm
-rw-rw---- 1 mysql mysql 3.8K Oct 10 15:21 events_waits_current.frm
-rw-rw---- 1 mysql mysql  875 Oct 10 15:21 cond_instances.frm
-rw-rw---- 1 mysql mysql   61 Oct 10 15:21 db.opt

/media/server/MariaDB/mysql:
total 1.1M
-rw-rw---- 1 mysql mysql 3.0K Oct 10 15:21 help_category.MYI
-rw-rw---- 1 mysql mysql  16K Oct 10 15:21 help_keyword.MYI
-rw-rw---- 1 mysql mysql 9.1K Oct 10 15:21 help_relation.MYD
-rw-rw---- 1 mysql mysql  19K Oct 10 15:21 help_relation.MYI
-rw-rw---- 1 mysql mysql  20K Oct 10 15:21 help_topic.MYI
-rw-rw---- 1 mysql mysql  90K Oct 10 15:21 help_keyword.MYD
-rw-rw---- 1 mysql mysql 396K Oct 10 15:21 help_topic.MYD
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 help_category.MYD
-rw-rw---- 1 mysql mysql 2.5K Oct 10 15:21 proxies_priv.MYD
-rw-rw---- 1 mysql mysql  10K Oct 10 15:21 proxies_priv.MYI
-rw-rw---- 1 mysql mysql   68 Oct 10 15:21 user.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 user.MYI
-rw-rw---- 1 mysql mysql  96K Oct 10 15:21 gtid_slave_pos.ibd
-rw-rw---- 1 mysql mysql  96K Oct 10 15:21 innodb_index_stats.ibd
-rw-rw---- 1 mysql mysql  96K Oct 10 15:21 innodb_table_stats.ibd
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 gtid_slave_pos.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 index_stats.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 index_stats.MYI
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 column_stats.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 column_stats.MYI
-rw-rw---- 1 mysql mysql 1.6K Oct 10 15:21 index_stats.frm
-rw-rw---- 1 mysql mysql 2.6K Oct 10 15:21 column_stats.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 table_stats.MYD
-rw-rw---- 1 mysql mysql 2.0K Oct 10 15:21 table_stats.MYI
-rw-rw---- 1 mysql mysql 1.4K Oct 10 15:21 table_stats.frm
-rw-rw---- 1 mysql mysql 2.8K Oct 10 15:21 proxies_priv.frm
-rw-rw---- 1 mysql mysql 4.9K Oct 10 15:21 innodb_index_stats.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 event.MYD
-rw-rw---- 1 mysql mysql 2.0K Oct 10 15:21 event.MYI
-rw-rw---- 1 mysql mysql 1.5K Oct 10 15:21 innodb_table_stats.frm
-rw-rw---- 1 mysql mysql 3.7K Oct 10 15:21 event.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 slow_log.CSV
-rw-rw---- 1 mysql mysql   35 Oct 10 15:21 slow_log.CSM
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 general_log.CSV
-rw-rw---- 1 mysql mysql 2.3K Oct 10 15:21 slow_log.frm
-rw-rw---- 1 mysql mysql   35 Oct 10 15:21 general_log.CSM
-rw-rw---- 1 mysql mysql  804 Oct 10 15:21 general_log.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 procs_priv.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 procs_priv.MYI
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 proc.MYD
-rw-rw---- 1 mysql mysql 2.0K Oct 10 15:21 proc.MYI
-rw-rw---- 1 mysql mysql 2.9K Oct 10 15:21 procs_priv.frm
-rw-rw---- 1 mysql mysql 3.4K Oct 10 15:21 proc.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 time_zone_leap_second.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 time_zone_leap_second.MYI
-rw-rw---- 1 mysql mysql  971 Oct 10 15:21 time_zone_leap_second.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 time_zone_transition_type.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 time_zone_transition_type.MYI
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 time_zone_transition.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 time_zone_transition.MYI
-rw-rw---- 1 mysql mysql 1.1K Oct 10 15:21 time_zone_transition_type.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 time_zone.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 time_zone.MYI
-rw-rw---- 1 mysql mysql 1013 Oct 10 15:21 time_zone_transition.frm
-rw-rw---- 1 mysql mysql  973 Oct 10 15:21 time_zone.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 time_zone_name.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 time_zone_name.MYI
-rw-rw---- 1 mysql mysql 1.2K Oct 10 15:21 time_zone_name.frm
-rw-rw---- 1 mysql mysql 1.6K Oct 10 15:21 help_keyword.frm
-rw-rw---- 1 mysql mysql  970 Oct 10 15:21 help_relation.frm
-rw-rw---- 1 mysql mysql 1.7K Oct 10 15:21 help_category.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 columns_priv.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 columns_priv.MYI
-rw-rw---- 1 mysql mysql 1.8K Oct 10 15:21 help_topic.frm
-rw-rw---- 1 mysql mysql 2.1K Oct 10 15:21 columns_priv.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 tables_priv.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 tables_priv.MYI
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 servers.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 servers.MYI
-rw-rw---- 1 mysql mysql 2.9K Oct 10 15:21 tables_priv.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 plugin.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 plugin.MYI
-rw-rw---- 1 mysql mysql 2.7K Oct 10 15:21 servers.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 func.MYD
-rw-rw---- 1 mysql mysql 1.0K Oct 10 15:21 func.MYI
-rw-rw---- 1 mysql mysql 1.5K Oct 10 15:21 plugin.frm
-rw-rw---- 1 mysql mysql 1.6K Oct 10 15:21 func.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 roles_mapping.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 roles_mapping.MYI
-rw-rw---- 1 mysql mysql 1.7K Oct 10 15:21 roles_mapping.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 host.MYD
-rw-rw---- 1 mysql mysql 2.0K Oct 10 15:21 host.MYI
-rw-rw---- 1 mysql mysql 2.9K Oct 10 15:21 user.frm
-rw-rw---- 1 mysql mysql    0 Oct 10 15:21 db.MYD
-rw-rw---- 1 mysql mysql 4.0K Oct 10 15:21 db.MYI
-rw-rw---- 1 mysql mysql 1.9K Oct 10 15:21 host.frm
-rw-rw---- 1 mysql mysql 2.7K Oct 10 15:21 db.frm



[ERROR] mysqld: Can't create/write to file '/media/server/MariaDB/aria_log_control' (Errcode: 13 "Permission denied")
[ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/media/server/MariaDB/aria_log_control'
[ERROR] Plugin 'Aria' init function returned error.
[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.

...

[ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
[ERROR] InnoDB: The system tablespace must be writable!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

...

[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[ERROR] Unknown/unsupported storage engine: InnoDB

...

[ERROR] Can't start server : Bind on unix socket: Permission denied
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
[ERROR] Aborting

...

mysqld_safe[5025]: mysqld from pid file /var/run/mysqld/mysqld.pid ended
/etc/init.d/mysql[5316]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[5316]: [61B blob data]
systemd[1]: mysql.service: Control process exited, code=exited status=1
mysql[4784]:    ...fail!
/etc/init.d/mysql[5316]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'
systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- Subject: Unit mysql.service has failed

答案1

它说,权限被拒绝。这可能发生在你可能错过的两件事上。检查 apparmor 是否正在运行?如果是,请禁用它或将 mysqldatadir 添加到 apparmor 配置文件中,以便它接受新的路径更改。它是 RHEL 中 SElinux 的替代品。另一种可能性是所有权和权限。除上述之外,my.cnf 中的所有配置

1)检查 Apparmor 状态并禁用它:

sudo apparmor_status
sudo service apparmor stop
sudo update-rc.d -f apparmor remove

2)检查mysqldatadir的所有权。

chown -R mysql.mysql /MariaDBData
chmod -R 775 /MariaDBData

如果你正在为 Fresh mariaDB 服务器设置新的 datadir 路径,那么在启动之前,你可以先备份并删除新 datadir 路径中的所有文件和文件夹,然后以 root 身份从终端尝试:

mysql_install_db

这将在新的 datadir 中安装所有必要的文件,以便使用来自 my.cnf 的当前配置启动。因此,从这里我们可以查看是否存在任何权限被拒绝的问题或错误。如果它回复 ok,则正常启动它。

systemctl start mariadb

答案2

几件事,为什么有一个datadir = /../xxxxx最好给它像

datadir = /mnt/MariaDBData  or some absolute path

2) 为什么 /MariaDBData 的用户和组是“服务器”最好使用我在之前的回答中显示的命令将其更改为 mysql。正如您所提到的,您还没有运行我的命令。如果是这样,那么用户和组的所有权将是“mysql”。

3)使用命令升级mysql表:

mysql_upgrade.

相关内容