|
@ -98,25 +98,25 @@ class MariadbInstallCommand extends Command |
|
|
|
|
|
|
|
|
// make sure root can only access from local
|
|
|
// make sure root can only access from local
|
|
|
$this->info('Mariadb make sure root can ony access from local...'); |
|
|
$this->info('Mariadb make sure root can ony access from local...'); |
|
|
exec('sudo mysql -u root -e "DELETE FROM mysql.user WHERE User=\'root\' AND Host NOT IN (\'localhost\', \'127.0.0.1\', \'::1\');"'); |
|
|
|
|
|
|
|
|
system('sudo mysql -u root -e "DELETE FROM mysql.user WHERE User=\'root\' AND Host NOT IN (\'localhost\', \'127.0.0.1\', \'::1\');"'); |
|
|
|
|
|
|
|
|
// delete anonymous user
|
|
|
// delete anonymous user
|
|
|
$this->info('Mariadb delete anonymous user...'); |
|
|
$this->info('Mariadb delete anonymous user...'); |
|
|
exec('sudo mysql -u root -e "DELETE FROM mysql.user WHERE User=\'\';"'); |
|
|
|
|
|
|
|
|
system('sudo mysql -u root -e "DELETE FROM mysql.user WHERE User=\'\';"'); |
|
|
|
|
|
|
|
|
// drop test database and anthing familiar
|
|
|
// drop test database and anthing familiar
|
|
|
$this->info('Mariadb drop test and anthing familiar...'); |
|
|
$this->info('Mariadb drop test and anthing familiar...'); |
|
|
exec('sudo mysql -u root -e "DROP DATABASE IF EXISTS test;"'); |
|
|
|
|
|
exec('sudo mysql -u root -e "DELETE FROM mysql.db WHERE Db=\'test\' OR Db=\'test_%\';"'); |
|
|
|
|
|
|
|
|
system('sudo mysql -u root -e "DROP DATABASE IF EXISTS test;"'); |
|
|
|
|
|
system('sudo mysql -u root -e "DELETE FROM mysql.db WHERE Db=\'test\' OR Db=\'test_%\';"'); |
|
|
|
|
|
|
|
|
// remove plugin for root and set password
|
|
|
// remove plugin for root and set password
|
|
|
$this->info('Mariadb add password for root...'); |
|
|
$this->info('Mariadb add password for root...'); |
|
|
|
|
|
|
|
|
if ($version === '10.4') { |
|
|
if ($version === '10.4') { |
|
|
exec('sudo mysql -u root -e "ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\''.$password.'\'); FLUSH PRIVILEGES;"'); |
|
|
|
|
|
|
|
|
system('sudo mysql -u root -e "ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD(\''.$password.'\'); FLUSH PRIVILEGES;"'); |
|
|
} else { |
|
|
} else { |
|
|
exec('sudo mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD(\''.$password.'\') WHERE User=\'root\'; FLUSH PRIVILEGES;"'); |
|
|
|
|
|
exec('sudo mysql -u root -e "UPDATE mysql.user SET plugin=\'\' where User=\'root\';"'); |
|
|
|
|
|
|
|
|
system('sudo mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD(\''.$password.'\') WHERE User=\'root\'; FLUSH PRIVILEGES;"'); |
|
|
|
|
|
system('sudo mysql -u root -e "UPDATE mysql.user SET plugin=\'\' where User=\'root\';"'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
file_put_contents(self::MCP_LOG_FILE, "Mariadb installed\nuser: root\npassword: $password\n--\n", FILE_APPEND); |
|
|
file_put_contents(self::MCP_LOG_FILE, "Mariadb installed\nuser: root\npassword: $password\n--\n", FILE_APPEND); |
|
|