create database DatabaseName;
Category: Raindrop
How to create a user and grant privileges on specific database in MySQL
create user 'User'@'localhost' identified by 'Password';
create database Database;
grant all on Database.* to 'User'@'localhost';
How to display privileges in MySQL
show grants;
show grants for 'User'@'Host'
How to grant privileges in MySQL
grant all on Database.* to 'User'@'Host';
grant alter, alter routine, create, create routine, create temporary tables, create view, delete, drop, event, execute, index, insert, lock tables, references, select, show view, trigger, update on Database.* to 'User'@'Host';
How to create users in MySQL
create user 'User1'@'localhost', 'User2'@'Host', 'User3' identified by 'Password';
How to show a user information in MySQL
select * from mysql.user where user='User'\G;
How to delete users in MySQL
drop user 'User1'@'localhost', 'User2'@'Host', 'User3'@'%';
How to find the public IP address
curl https://ipinfo.io/ip
How to allow remote access to MySQL on Ubuntu
sudo sed -i.bak -e '0,/127.0.0.1/s//0.0.0.0/' /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql
update mysql.user set host='%' where user='User';
sudo ufw allow mysql && sudo ufw reload && sudo ufw status
mysql --host=Host --user=User --password=Password
How to check which port MySQL using
show variables where variable_name='port'