Last active
January 26, 2017 15:12
-
-
Save fagnersilva/37c188d81c2b78710c51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Install MySQL | |
| sudo apt-get install mysql-server | |
| -------------------------------------------------------------------------------------------------------------------- | |
| Harden MySQL Server | |
| sudo mysql_secure_installation | |
| -------------------------------------------------------------------------------------------------------------------- | |
| Root Login | |
| mysql -u root -p | |
| -------------------------------------------------------------------------------------------------------------------- | |
| Create a New MySQL User and Database | |
| create database testdb; | |
| create user 'testuser'@'localhost' identified by 'password'; | |
| grant all on testdb.* to 'testuser'; | |
| grant all on testdb.* to 'testuser' identified by 'password'; | |
| -------------------------------------------------------------------------------------------------------------------- | |
| Create a Sample Table | |
| mysql -u testuser -p | |
| use testdb; | |
| create table customers (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT); | |
| -------------------------------------------------------------------------------------------------------------------- | |
| external access permission | |
| sudo vim /etc/mysql/my.cnf | |
| bind-address = 0.0.0.0 | |
| $ iptables -F | |
| $ iptables -L | |
| $ service iptables save | |
| -------------------------------------------------------------------------------------------------------------------- | |
| Reset the MySQL Root Password | |
| sudo service mysql stop | |
| sudo dpkg-reconfigure mysql-server | |
| sudo service mysql start |
GRANT ALL ON . TO 'root'@'%' IDENTIFIED BY '[senha]' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remover permissões de usuários
revoke all on banco.* from usuario;