0

After I have changed the datadir of my MariaDB (Ubuntu 16.04), I cannot restart mysql anymore.

I changed the path of the data directory in the /etc/my.cnf file. But if I try to start MariaDB with sudo /etc/init.d/mysql start , I get the following errors:

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!

The file my.cnf looks like this:

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

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

The file /path/mysqld.sock does not exist, but I have granted permissions to the folder.

How can I manage to start mysql again?

EDIT 1: Now I also get those errors additionnally:

[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.

EDIT 2: Now I am using only /etc/mysql/mariadb.conf.d/50-server.cnf to alter the config. These are the basic settings:

# * 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

EDIT3: Outputs of ls -lht /.../MariaDBData/* and 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

EDIT 4: Outputs of journalctl -xe and systemctl 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'.

EDIT 5: Permissions & Error messages after using ext3 file format instead of 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
7
  • Do not modify the my.cnf file, revert changes and make default. AFAIK in ubuntu 16.04, if you want make modification then modify in /etc/mysql/mysql.conf.d/mysqld.cnf
    – d a i s y
    Oct 9, 2018 at 12:13
  • Since I am using mariadb, I do not have this folder. I have the folder /etc/mysql/mariadb.conf.d/. There are the files 50-client.cnf, 50-mysql-clients.cnf, 50-mysqld_safe.cnf and 50-server.cnf.
    – jwarz
    Oct 9, 2018 at 12:31
  • Altering the 50-server.cnf instead of the my.cnf results in the same error.
    – jwarz
    Oct 9, 2018 at 12:52
  • 1
    You seem to be changing the socket location, not only the data location. Make sure those directories exist and that they are writable by the user that MariaDB (if it's the same as MySQL, the user would be mysql)
    – Dan
    Oct 9, 2018 at 13:12
  • I tried both the default socket location var/run/mysqld/mysqld.sock and new/datadir/mysqld.sock. I get always the same error.
    – jwarz
    Oct 9, 2018 at 13:29

2 Answers 2

0

It says , permission denied. this can happen of two things which you might have missed. check apparmor is running ? if yes disable it or add mysqldatadir to apparmor profile for it to accept the new path change. its an alternative to SElinux in RHEL. The other possibility is ownership and permissions. Apart from above it all the configurations in my.cnf

1) Check Apparmor status and disable it:

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

2) Check ownership of mysqldatadir.

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

if you are setting up a new path for datadir for Fresh mariaDB server, prior to starting you can, delete any files and folders in the new datadir path after taking a backup, then try from terminal as root:

mysql_install_db

This will install all necessary files in new datadir for starting up with current configs from my.cnf . So from here we can see if there is any permission denied issues or errors as well. If it replies ok then start it as normal.

systemctl start mariadb
7
  • Thank you very much for this approach. I have tried all your commands. Unfortunately the command mysql_install_db results in Installation of system tables failed! Examine the logs in /MariaDBData for more information. I did not change the socket path.
    – jwarz
    Oct 9, 2018 at 13:40
  • post outpout of ls -lht /MariaDBData/* and ls -lhtd /MariaDBData
    – SAGAR Nair
    Oct 9, 2018 at 13:44
  • @jstuhh post full output of mysql error log and your my.cnf
    – SAGAR Nair
    Oct 9, 2018 at 13:47
  • See EDITS 2, 3 and 4.
    – jwarz
    Oct 9, 2018 at 13:57
  • @jstuhh Post the outputs after executing all my answers given above. Make sure that commands are executed successfully, if not explain the full story.
    – SAGAR Nair
    Oct 9, 2018 at 14:11
0

Few things, why have a datadir = /../xxxxx better give it like

datadir = /mnt/MariaDBData  or some absolute path

2) Why user and group of /MariaDBData is "server" better change it to mysql using the command I shown in my earlier answer. You haven't run my command as you mentioned. if so then user and group ownership will be "mysql".

3) upgrade mysql tables using command:

mysql_upgrade.
5
  • 1) I do not know how to create a new mount. But I will consider it. 2) It remains unexplainable to me, why those commands do not change the ownership. I am trying to change the entire permissions for the mount right now. 3) The command results in Version check failed. Got the following error when calling the 'mysql' command line client ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") FATAL ERROR: Upgrade failed
    – jwarz
    Oct 9, 2018 at 14:25
  • I think I can't change it, because it is a NTFS filesystem. Is there another way?
    – jwarz
    Oct 9, 2018 at 14:39
  • How you got a NTFS in Linux server ? Are you using windows server. Well my suggestion is following:
    – SAGAR Nair
    Oct 9, 2018 at 21:15
  • Several people are accessing this server from Linux, macOS and windows systems to process their data. That is why this mount is formatted in NTFS. I have heard changing permissions in fstab while mounting this disk could solve this problem. Anyway, thank you very much for your time and your support. I will try using an external hard drive (formatted in ext3) to check if the filesystem is the actual cause.
    – jwarz
    Oct 10, 2018 at 7:26
  • Unfortunately changing the file format did not solve my problems. Now I can grant the proper permissions and ownership, but I am still getting similar errors (see EDIT 5). Creating the tables via mysql_install_db does not work either.
    – jwarz
    Oct 10, 2018 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.