Skip to content

Instantly share code, notes, and snippets.

@mahamuniraviraj
Created May 20, 2017 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahamuniraviraj/aaf7d4a1b5f7448d04f4796dcabade7c to your computer and use it in GitHub Desktop.
Save mahamuniraviraj/aaf7d4a1b5f7448d04f4796dcabade7c to your computer and use it in GitHub Desktop.
Install Mysql Community server latest (v5.7) on Centos 7
# Download the rpm file to add mysql repository from https://dev.mysql.com/downloads/repo/yum/
# download (mysql57-community-release-el7-XX.noarch.rpm) here XX is current version
# Downloaded file (mysql57-community-release-el7-11.noarch.rpm)
# Now add mysql repo
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
# Now we can install mysql community
yum install mysql-server
# start the daemon
systemctl start mysqld
# View status
systemctl status mysqld
# Get Temp password Copy password from ouptput
grep 'temporary password' /var/log/mysqld.log
> A temporary password is generated for root@localhost: uB-QwIhaz5hG
# Secure mysql installation
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:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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!
# =========================================================================
# Test mysql installation by logging into server
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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>
# On Success mysql prompt will be shown
# execute some sql queries
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.18 |
+-----------+
1 row in set (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2017-05-21 01:59:22 |
+---------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> exit
Bye
#============================================================================================
install MySQL Workbench :: GUI for MySQL Administration and query execution
# Install epel repo to install required packages
yum install epel-release
# install mysql workbench community
yum install mysql-workbench-community
# Opening workbench may give unsupported OS error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment