Install MySQL 5.7 on Fedora 25/24, Centos/rhel 7.3/6.8/5.11

Source: Internet
Author: User

1. Change Root Userbash
su -## OR ##sudo -i
2. Install MySQL YUM Repositoryfedorabash
## Fedora 25 ##dnf install https://dev.mysql.com/get/mysql57-community-release-fc25-9.noarch.rpm## Fedora 24 ##dnf install https://dev.mysql.com/get/mysql57-community-release-fc24-9.noarch.rpm## Fedora 23 ##dnf install https://dev.mysql.com/get/mysql57-community-release-fc23-9.noarch.rpm
CentOS and Red Hat (RHEL) Bash
## CentOS 7 and Red Hat (RHEL) 7 ##yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm## CentOS 6 and Red Hat (RHEL) 6 ##yum localinstall https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm## CentOS 5 and Red Hat (RHEL) 5 ## yum localinstall https://dev.mysql.com/get/mysql57-community-release-el5-7.noarch.rpm
3. Update or Install MySQL 5.7.17Fedora 25/24/23bash
install mysql-community-server
CentOS 7.3/6.8/5.11 and Red Hat (RHEL) 7.3/6.8/5.11bash
install mysql-community-server
4. Start MySQL server and autostart MySQL on Bootfedora 25/24/23 and CentOS 7.3 and Red Hat (RHEL) 7.3Bash
## use restart after updatesystemctl enable mysqld.service
CentOS 6.8/5.11 and Red Hat (RHEL) 6.8/5.11bash
## use restart after update## OR ##service mysql start ## use restart after updatechkconfig --levels 235 mysqld on
5. Get Your Generated Random root Passwordbash
grep ‘A temporary password is generated for [email protected]‘ /var/log/mysqld.log |tail -1

Example Output:

Bash
[Note] A temporary password is generated for [email protected]: -et)QoL4MLid

and root password is: -et) Qol4mlid

6. MySQL Secure Installation
    • Change root password
    • Remove Anonymous Users
    • Disallow Root Login remotely
    • Remove test database and access to it
    • Reload Privilege Tables
Start MySQL Secure installation with following Commandbash
/usr/bin/mysql_secure_installation

Output:

Bash
Securing the MySQL Server deployment. Enter PasswordFor user root:the' Validate_password ' plugin is installed on the server. The subsequent steps would run with the existing configurationof the plugin. Using Existing passwordFor Root. Estimated strength of the password:100 change the passwordFor Root?(Press Y| YFor Yes, any and other keyFor No): ynew password:re-enter New password:estimated strength of the password:100 do you wish toContinue with the password provided?(Press Y| YFor Yes, any and other keyFor No): yby default, a MySQL installation have an anonymous user,allowing anyone to log into MySQL without have to Havea user A Ccount createdFor them. This was intended onlyFortesting, and toMake the installation go a bit smoother. You should remove them before moving into a productionenvironment. Remove anonymous users?(Press Y| YFor Yes, any and other keyFor No): ysuccess.normally, Root should only is allowed to connect from' localhost '. This ensures, someone cannot guess atthe root password from the network. Disallow Root login remotely?(Press Y| YFor Yes, any and other keyFor No): ysuccess.by default, MySQL comes with a database named' Test ' thatanyone can access. This was also intended onlyFor Testing,and should is removed before moving into a productionenvironment. RemoveTest database and access to it?| Y for Yes, any other key for No test Databasetest database ... Success.reloading the privilege tables would ensure that all changesmade so far would take effect immediately. Reload privilege tables now? | Y for Yes, any other key for No !  

Note:if you don ' t want some reason, does a "MySQL Secure installation" Then at least it's very important to change the root User ' s password

Bash
[your_password_here]## Example ##mysqladmin -u root password myownsecrectpass
7. Connect to MySQL database (localhost) with Passwordbash
mysql -u root -p## OR ##mysql -h localhost -u root -p
8. Create Database, create MySQL User and Enable Remote Connections to MySQL database

This example uses following parameters:

    • Db_name = WebDB
    • user_name = Webdb_user
    • REMOTE_IP = 10.0.15.25
    • PASSWORD = password123
    • PERMISSIONS = All
Sql
# # CREATE DATABASE # #mysql>CREATEDATABASE WEBDB;# # CREATE USER # #mysql>CREATEUSER ' Webdb_user ' @ ' 10.0.15.25 ' identified by ' password123 '  ; ## GRANT PERMISSIONS # #mysql > grant all on webdb* to  ' Webdb_user ' @ ' 10.0.15.25 ' ; # # Flush privileges, tell the server to reload the grant tables # #mysql > FLUSH privileges        
Enable Remote Connection to MariaDB server–> Open MySQL Port (3306) on Iptables Firewall (as root user again) 1. Fedora 25/24/23 and centos/red Hat (RHEL) 7.31.1 Add New Rule to Firewalldbash
firewall-cmd --permanent --zone=public --add-service=mysql## OR ##firewall-cmd --permanent --zone=public --add --port=3306/tcp
1.2 Restart Firewalld.servicebash
systemctl restart firewalld.service
2. Centos/red Hat (RHEL) 6.8/5.112.1 edit/etc/sysconfig/iptables File:bash
nano -w /etc/sysconfig/iptables
2.2 Add following INPUT Rule:bash
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
2.3 Restart Iptables Firewall:bash
service iptables restart## OR ##/etc/init.d/iptables restart
3. Test Remote Connectionbash
mysql -h 10.0.15.25 -u myusername -p
Categories:
    • Featured,
    • Linux
    • Servers,
    • Sql
Tagged with:
    • Centos
    • Fedora
    • Mysql
    • Oracle,
    • Red Hat,
    • RHEL,
    • Scientific Linux
Share
Related Posts
  • Navigate_nextinstall MariaDB 10.1 on Fedora 25/24, Centos/rhel 7.3/6.8/5.11
  • Navigate_nextinstall PostgreSQL 9.4 on Fedora 23/22, CENTOS/RHEL/SL 7.2/6.7/5.11
  • Navigate_nextinstall WordPress 4.1.1 on Fedora 21/20, Centos/rhel 7/6.6/5.11
  • Navigate_nextinstall phpMyAdmin 4.3.10 on Fedora 21/20, Centos/rhel 6.6/5.11
  • Navigate_nextinstall SVN Server on Fedora 25/24, Centos/rhel 7.3/6.8/5.11

Install MySQL 5.7 on Fedora 25/24, Centos/rhel 7.3/6.8/5.11

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.