MySQL Basic - HaymonEdmur/DockerConfiguration GitHub Wiki

How to install MySQL on CentOS 7 by downloading rpm repositories

https://www.youtube.com/watch?v=CZvf_k99C0Q

# ls -l mysql80-community-release-el7-1.noarch.rpm

# rpm -lqvp mysql80-community-release-el7-1.noarch.rpm
warning: mysql80-community-release-el7-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
-rw-r--r--    1 root    root                    27840 Feb 22 03:49 /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
-rw-r--r--    1 root    root                     1885 Feb 22 03:49 /etc/yum.repos.d/mysql-community-source.repo
-rw-r--r--    1 root    root                     1864 Feb 22 03:49 /etc/yum.repos.d/mysql-community.repo
  • Install mysql rpm repository to download actual rpm package
# ls -l mysql80-community-release-el7-1.noarch.rpm

# rpm -ivh mysql80-community-release-el7-1.noarch.rpm
warning: mysql80-community-release-el7-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-1  ################################# [100%]
  • Now download and install rpm package
# yum install -y mysql-server 
  • Systemd configuration. Read following link
http://dev.mysql.com/doc/refman/en/using-systemd.html
  • Start mysqld service
systemctl start mysqld
  • Get generated password for root
# grep -i password /var/log/mysqld.log
  • Edit /etc/my.cnf and add following line for security
  validate_password.policy=LOW
  • Restart mysqld daemon
systemctl restart mysqld
  • Run following command to change root (admin) default password. Use default password generated in log file
/bin/mysql_secure_installation
Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new password:

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No:
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) :

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

  • Connect to your MySQL database
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.11 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>