Create User
CREATE USER 'ddl'@'%' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL ON ddl.* TO 'ddl'@'%';
FLUSH PRIVILEGES;
List Current DB Users
select User,Host from mysql.user;
To review security and change root password
sudo mysql_secure_installation
To update root password only
UPDATE mysql.user SET Password=PASSWORD('P@ssw0rd') WHERE User='root';
flush privileges;
To get information about DB
select version();
show databases;
use DB_Name
show tables;
Restart database server
sudo service mysql restart
Export/Import DB Backup
mysqldump -u root -p koha_library > kohaBackup.sql
Compress backup file
tar -czvf kohaBackup.tar.gz kohaBackup.sql
If DB service not start and you need to view the error log
sudo journalctl -xe
tail -30 /var/log/mysql/error.log
Stop/Start/Restart DB service
sudo service mysqld stop
sudo service mysql stop
sudo service mysql restart
sudo service mysql start
or
sudo service mariadb start
Get current service status
sudo systemctl status mysql.service
or
sudo service mariadb status
Start DB in safe mode
sudo /usr/bin/mysqld_safe
Stop/Start DB in case of error :
systemctl stop mysql.service; systemctl stop mysql.socket
killall mysqld
rm -f /var/run/mysqld/mysqld.sock
systemctl start mysql
Check if MySQL service running
ps aux | grep mysqld
CREATE USER 'ddl'@'%' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL ON ddl.* TO 'ddl'@'%';
FLUSH PRIVILEGES;
List Current DB Users
select User,Host from mysql.user;
To review security and change root password
sudo mysql_secure_installation
To update root password only
UPDATE mysql.user SET Password=PASSWORD('P@ssw0rd') WHERE User='root';
flush privileges;
To get information about DB
select version();
show databases;
use DB_Name
show tables;
Restart database server
sudo service mysql restart
Export/Import DB Backup
mysqldump -u root -p koha_library > kohaBackup.sql
Export:
mysqldump -u username –-password=your_password database_name > file.sql
Import:
mysql -u username –-password=your_password database_name < file.sql
Compress backup file
tar -czvf kohaBackup.tar.gz kohaBackup.sql
If DB service not start and you need to view the error log
sudo journalctl -xe
tail -30 /var/log/mysql/error.log
Stop/Start/Restart DB service
sudo service mysqld stop
sudo service mysql stop
sudo service mysql restart
sudo service mysql start
or
sudo service mariadb start
Get current service status
sudo systemctl status mysql.service
or
sudo service mariadb status
Start DB in safe mode
sudo /usr/bin/mysqld_safe
Stop/Start DB in case of error :
systemctl stop mysql.service; systemctl stop mysql.socket
killall mysqld
rm -f /var/run/mysqld/mysqld.sock
systemctl start mysql
Check if MySQL service running
ps aux | grep mysqld
No comments:
Post a Comment