MySQL on Linux
1. Install
CentOS 7:
Import the key before running the installer:
Download and install:
Enable and start MySQL service:
Setting a permanent root password and MySQL security settings:
MySQL expects that your new password should consist of at least 8 characters, contain uppercase and lowercase letters, numbers and special characters (do not forget the password you set, it will come in handy later). After a successful password change, the following questions are recommended to answer "Y":
Note:
In CentOS 7, the default root password can be found using
after receiving the password, run mysql_secure_installation
, for setup new root password:
The following is an example for CentOs 7:
Ubuntu 18.04:
Note:
click "ok" to confirm the server installation
during the installation you will be prompted to enter the MySQL user password. Remember this password for future use.
run
mysql_secure_installation
, to complete the installation:
Ubuntu 20.04, 22.04:
Change the authentication parameters:
Сhange <mysql_root_password>
to a strong password,
To exit from the MySQL console, press Ctrl+D.
run
mysql_secure_installation
, to complete the installation:
2. Creating MySQL User and Database
2.1. Run MySQL client and enter your MySQL root password
2.2. The following lines create a database hesdb
, the user with name hesuser
and password <user_password>
. Сhange <user_password>
to a strong password, otherwise you may get a password validator error.
To exit from the MySQL console, press Ctrl+D.
Last updated