Install mysql

Steps to install :

sudo apt-get install mysql-server
sudo mysql_secure_installation

Steps :

  1. Validate Password Plugin – N
  2. Password Validation Policy – 0
  3. Set new Passwowrd for root – root
  4. Do you wish to continue with the password -N
  5. Remove anonymus users – N
  6. Disallow root to login remotely – N
  7. Remove test database and access to it – N
  8. Reload privilege table now – N

Start/Stop/Restart mysql service :

sudo service mysql restart
sudo service mysql stop
sudo service mysql start

Step to Login to mysql :

sudo mysql -u root -p
<enter the password>
show databases;
use <database-name>

Create new user in mysql :

CREATE USER 'tyson'@'localhost' IDENTIFIED BY 'tyson';
GRANT ALL PRIVILEGES ON database_name.* TO 'tyson'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'tyson'@'localhost';

If your password does not satisfy the current policy requirements

  • mysql -u root -p
  • mysql> uninstall plugin validate_password;
  • mysql> SHOW VARIABLES LIKE ‘validate_password%’;
  • mysql> SET GLOBAL validate_password_length = 1;
  • mysql> SET GLOBAL validate_password_number_count = 0;
  • mysql> SET GLOBAL validate_password.policy = LOW;

Leave a Comment