wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
[root@clusterserver2 software]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
warning: mysql57-community-release-el7-8.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql57-community-release-el7-8 ################################# [100%]
After the installation of this package. We will get two new yum repo related to MySQL
[root@localhost ~]# ls -1 /etc/yum.repos.d/mysql-community* /etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community-source.repo [root@localhost ~]#
Installing MySQL Server
By using yum command, now we will install MySQL Server 5.6 . All dependencies will be installed itself.
yum install mysql-server
How to start/stop/restart MySQL Server
Now MySQL Server is installed on your system.
To start MySQL Service, run command
systemctl start mysqld
To stop MySQL Service, run command
systemctl stop mysqld
To restart MySQL Service, run command
systemctl restart mysqld
To get status of MySQL Service, run command
systemctl status mysqld
Reset MySQL root password
On fresh installation of MySQL Server. The MySQL root user password is blank.
For good security practice, we should reset the password MySQL root user.
On newly installed MySQL Server, we generally recommend to use the command script. You have to just follow the instructions.
mysql_secure_installation
In another method,you can log into MySQL server database and reset the password in secure way.
mysql -u root
You will see mysql prompt like this mysql> . Use the below given commands to reset root’s password.
mysql> use mysql; mysql> update user set password=PASSWORD("GIVE-NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit
MySQL version: 5.7.9
For development, using a MySQL server with strong password policy is dosing some matter.
If you set a simply password for someone, you will got an error like this:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
To change the default password plugin level, we can change the settings at runtime or in config file.
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
6 rows in set (0.01 sec)
The default level is MEDIUM
, we can change it to LOW
, which will only check the password’s length(min: 8 chars).
mysql> SET GLOBAL validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)
$ mysql -u root -p
>
set
password
for
root@localhost=password(
'newpass'
);
$ mysql -u root -p
> show variables like
'char%'
;
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir |
/usr/share/mysql/charsets/
|
+--------------------------+----------------------------+
8 rows
in
set
(0.00 sec)
Or we can set it in my.cnf
file
[mysqld]
validate_password_policy=LOW
systemctl restart mysqld.service
Recent Comments