Changes

From SME Server
Jump to navigationJump to search
1,460 bytes added ,  02:55, 19 August 2022
Line 76: Line 76:     
===Restoring accidentally deleted MySQL root user===
 
===Restoring accidentally deleted MySQL root user===
 +
<tabs container style="display: inline-block;"><tab name="For SME 10">
 +
mariadb 5.5 and up to 10.5
 +
systemctl stop mariadb
 +
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'`config get DomainName`' WITH GRANT OPTION;">/var/lib/mysql/set.rootuser
 +
echo "GRANT PROXY ON ''@'' TO 'root'@'`config get DomainName`' WITH GRANT OPTION;">>/var/lib/mysql/set.rootuser
 +
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;">>/var/lib/mysql/set.rootuser
 +
echo "GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION;">>/var/lib/mysql/set.rootuser
 +
expand-template /root/.my.cnf
 +
expand-template /var/lib/mysql/set.password
 +
/usr/libexec/mysqld --socket=/var/lib/mysql/mysql.sock --bootstrap --user=mysql --skip-grant-tables <( cat /var/lib/mysql/set.rootuser  /var/lib/mysql/set.password)
 +
exit
 +
systemctl start mariadb
 +
</tab><tab name="For SME 8 and up to 9">
 +
for MySQL  5.1.73
 +
cd /var/service/mysqld
 +
sv d .
 +
echo 'use mysql;'>set.rootuser
 +
echo "INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);">>set.rootuser
 +
expand-template /root/.my.cnf
 +
expand-template /var/service/mysqld/set.password
 +
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < set.rootuser
 +
/usr/libexec/mysqld --bootstrap --user=mysql --skip-grant-tables < set.password
 +
sv u .
 +
</tab><tab name="For SME 7.3">
 
Note: The following is only applicable on SME 7.3 and MySQL 4.1  
 
Note: The following is only applicable on SME 7.3 and MySQL 4.1  
 
  cd /var/service/mysqld
 
  cd /var/service/mysqld
Line 87: Line 111:  
  /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 .
 +
</tab>
 +
</tabs>
    
==MariaDB/MySQL fails to start==
 
==MariaDB/MySQL fails to start==
Super Admin, Wiki & Docs Team, Bureaucrats, Interface administrators, Administrators
3,258

edits

Navigation menu