Changes

From SME Server
Jump to navigationJump to search
1,764 bytes added ,  20:58, 4 July 2022
Line 84: Line 84:  
  /usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < set.password
 
  /usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < set.password
 
  sv u .
 
  sv u .
 +
 +
==MariaDB/MySQL fails to start==
 +
you need to investigate the cause by inspecting two logs :
 +
* service log
 +
journalctl -u mariadb
 +
 +
* mariadb log
 +
tail -f  /var/log/mariadb/mariadb.log
 +
 +
===Corrupted user table===
 +
Your error in mariadb log will include
 +
ERROR: 130  Incorrect file format 'user'
 +
 +
This could mostly occurs after a power outage. mysql.user table is a MYSIAM type
 +
# ll /var/lib/mysql/mysql/user.*
 +
-rw-rw---- 1 mysql mysql 10630  3 jui 21:08 /var/lib/mysql/mysql/user.frm
 +
-rw-rw---- 1 mysql mysql  488  3 jui 21:08 /var/lib/mysql/mysql/user.MYD
 +
-rw-rw---- 1 mysql mysql  2048  3 jui 21:08 /var/lib/mysql/mysql/user.MYI
 +
In this case you might see user.MYD or user.MYI with 0 byte size. If the issue is on MYI this is the index you should be able to rebuild, if it is on the MYD, this is the data, you will need a backup to restore from.
 +
 +
as root, first start mariadb without grant table
 +
systemctl stop mariadb
 +
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables
 +
 +
then use mysql command line
 +
mysqlcheck mysql
 +
if wound any error try
 +
mysqlcheck mysql --repair
 +
if it fails then you  needs to do a restore. You might have a dump in /home/e-smith/db/mysql/mysql.dump. Wishing it is up to date. I suggest you to copy it and just extract the part for the table you are missing.
 +
You need what is under
 +
--
 +
-- Table structure for table `user`
 +
--
 +
and
 +
--
 +
-- Dumping data for table `user`
 +
--
 +
 +
Considering your table dump is now in a file called /home/e-smith/db/mysql/mysql.user.dump, do
 +
mysql mysql < /home/e-smith/db/mysql/mysql.user.dump
 +
expand-template /var/service/mysqld/set.password
 +
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < /var/service/mysqld/set.password
 +
mysqladmin shutdown
 +
systemctl start mariadb
    
==Access MariaDB/MySQL using port from the localhost and local network==
 
==Access MariaDB/MySQL using port from the localhost and local network==
Super Admin, Wiki & Docs Team, Bureaucrats, Interface administrators, Administrators
3,250

edits

Navigation menu