1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2025-02-02 03:58:25 +00:00

19 lines
1.0 KiB
Bash
Raw Normal View History

2020-06-21 18:03:59 +02:00
# *****************************************************************************
# BASICS
# *****************************************************************************
2020-06-21 18:37:44 +02:00
mysqldump -h hostname -u username -p database_name -P port > file.sql # Export database
mysql -u username -p database_name < file.sql # Import database
2020-07-03 14:29:06 +02:00
SHOW PROCESSLIST; # Show you any queries that are currently running or in the queue to run
2020-09-11 11:02:31 +02:00
2021-09-06 12:22:38 +02:00
show status where `variable_name` = 'Threads_connected'; # Show all connected threads
show variables like 'max_connections'; # Show maximum number of allowed connections
2021-09-06 12:27:02 +02:00
SET GLOBAL max_connections = 150; ## Set new value for maximum connections (no restart needed but for permanent change update my.cnf)
2021-09-06 12:22:38 +02:00
2020-12-03 13:04:22 +01:00
GRANT ALL PRIVILEGES ON prospectwith.* TO 'power'@'localhost' WITH GRANT OPTION; # Grant all privileges on database
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user
mysql -u root -pmypassword -e "MY SQL QUERY" &>> query.log & disown # Run SQL query in the background