Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Change password by the pre-defined password above

Code Block
mysqladmin -u root -p passwordu<root> -p<password>

Adding a mysql user account

Code Block
mysql -uroot -p<password>

# below script is to create user account for local connection
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

# below script is to create user account can conneect from 1.2.3.4
CREATE USER 'newuser'@'1.2.3.4' IDENTIFIED BY 'user_password';

# below script is to create user account for any connection
CREATE USER 'newuser'@'%' IDENTIFIED BY 'user_password';

Granting user permission

Code Block
mysql -uroot -p<password>

# grant privileges on a certain database
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';

# grant privileges on all the database in the system
GRANT ALL PRIVILEGES ON *.* TO 'database_user'@'localhost';

# grant full privileges on all the database in the system
GRANT ALL PRIVILEGES ON *.* TO 'database_user'@'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;



STEP 5. Initial MySQL Configuration

...