In this tutorial we will learn, how to install MySQL Server 5.6 on CentOS 7 / RHEL 7 . In our previous post, we have installed MySQL Server 5.6 on CentOS 6.x/RHEL 7.x.
In CentOS 7/ RHEL 7 , now MariaDB is introduced as a defualt database. Still many Organisations/Company would like to continue with MySQL. Whereas System Admin who earlier worked on MySQL can easily work on MariaDB. MariaDB is a community-developed fork of the MySQL relational database management system.
MariaDB’s lead developer is Michael “Monty” Widenius, the founder of MySQL and Monty Program AB. He had previously sold his company, MySQL AB, to Sun Microsystems for US$1 billion. MariaDB is named after Monty’s younger daughter, Maria. (Reference taken from Wikipedia)
Install MySQL Server 5.6 on CentOS 7 / RHEL 7
Follow the given below steps to install MySQL Server 5.6 .
You must be login with root user in system
Download the Yum Repo package of MySQL Server 5.6
Download the rpm package, which will create a yum repo file for MySQL Server installation.
yum install wget
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Install mysql-community-release-el7-5.noarch.rpm package
Install this downloaded rpm package by using rpm command.
rpm -ivh mysql-community-release-el7-5.noarch.rpm
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
very simple steps..
could you post more if i dont have online yum repo to use?
helps a lot..
thanks
Thanks! Help me a lot.!! 😀
Hello Alice,
Glad to see good feedback on this post.
Keep reading our blog.
Regards
Sharad
Thanks. Help me a lot.
Thanks Marcelo,
Regards
Sharad
i need your assistance on centos 7:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
it goes:
Resolving repo.mysql.com (repo.mysql.com) … 23.15.144.142 … connected .HTTP request sent, awaiting response … 404 not found [date, time] ERROR 404: Not Found
i’ve tried suggestions from this site: http://stackoverflow.com/questions/7623698/wget-cant-download-404-error/32323255#32323255 i’ve tried the (–header), the (“) quotes, the IPv4 (-4)
but i still get the error 404
Hi VariaS,
Is your network behind the proxy. I checked from my end , it is working fine for me.
Best Regards
Sharad
Thank you, this was very helpful.
You are welcome Tom,
Best Regards
Sharad
How to install MySQL-server-community-5.0.51a-0.rhel4.i386.rpm
on Centos 7 please update if there is a way
thanks
Hello Wahi,
Require following details, so that I can help you –
1. Operating System : ?
2. Arch : ?
Regards
Sharad
Thanks @sharad (sorry about bad english)
in advance i have a centos 7 and i want to install mysql offline using package MySQL-5.6.24-1.el7.x86_64.rpm-bundle which is related to redhat 7- 64 bit from website (https://dev.mysql.com/downloads/mysql/)
when i download it and install it by using command rpm
rpm -ivh MySQL-client-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-embedded-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.24-1.el7.x86_64.rpm
1) frist error is this
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.24-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
1-Solution) i have solved it using
rpm -evh mariadb-libs-5.5.41-2.el7_0.x86_64 –nodeps
Thanks @sharad (sorry about bad english) (sorry my replay will be many replies becuase it is very long )
in advance i have a centos 7 and i want to install mysql offline using package MySQL-5.6.24-1.el7.x86_64.rpm-bundle which is related to redhat 7- 64 bit from website (https://dev.mysql.com/downloads/mysql/)
when i download it and install it by using command rpm
rpm -ivh MySQL-client-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-embedded-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-5.6.24-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.24-1.el7.x86_64.rpm
1) frist error is this
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.24-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
1-Solution) i have solved it using
rpm -evh mariadb-libs-5.5.41-2.el7_0.x86_64 –nodeps
i need a tutorial to install mysql using offline method without yum with rpm
because i have not Internet connection to server
please help me ???
i have download MySQL-5.6.24-1.el7.x86_64.rpm-bundle from mysql website but i get errors during installation
Sure Beshoy, I will help you. Let’s discuss here in comments section. Share the error which you are getting.
Regards
Sharad
1) when i enter a blank password with command /usr/bin/mysql_secure_installation
give me error . i run mysqld_safe –skip-grant-tables & –> but not solve problem
and i did not enter any password ???
2) second question : i have select mysql for redhat 7 is it compatible with centos 7 or i must select linux version instead ?????
3) third question : mysql user was created using id 992 by checking /etc/passwd
mysql:x:992:990:MySQL server:/var/lib/mysql:/bin/bash
is this will make problem in future as the id=992 is not root privilege and i must be below 500 ?????
1) when i enter a blank password with command /usr/bin/mysql_secure_installation
give me error . i have run mysqld_safe –skip-grant-tables &
to solve it but i can not -> still i want a solution to this problem ????
2) second question : i have select mysql for redhat 7 is it compatible with centos 7 or i must select linux version instead ?????
3) third question : mysql user was created using id 992 by checking /etc/passwd
mysql:x:992:990:MySQL server:/var/lib/mysql:/bin/bash
is this will make problem in future as the id=992 is not root privilege and i must be below 500 ?????
4) did i select the correct package(MySQL-5.6.24-1.el7.x86_64.rpm-bundle.tar) or it not the correct package to installed on centos 7 ?????