Currently centos/red Hat (RHEL) 6.2 officially comes with the MySQL version for 5.1,mysql5.5 has come out.
The improvements are not only made in several ways compared to mysql5.1,mysql5.5:
- The performance has improved a lot.
- Change the default storage engine to InnoDB
- CPU multi-core processing performance improvement
- Enhanced replication, new semi-synchronous replication
- Enhanced table partitioning Capabilities
- Wait a minute
This article will guide you on how to install the latest version of the community version of MySQL under centos/red Hat (RHEL) 6.2 and Fedora 17/16. If you are upgrading MySQL, please back up your data and configuration files before upgrading. Installing MySQL 5.5 in centos/red Hat (RHEL) 6.2/5.8 and Fedora 17/16 let's get started. Step1. Switch to root user
[Plain]View Plaincopy
- Su-
- # # OR # #
- Sudo-i
Step2. Installing the Remi Software source Fedora Platform
[Plain]View Plaincopy
- # # Remi Dependency on Fedora 17, 16, 15
- RPM-UVH http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
- RPM-UVH http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
- # # Fedora 17 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-17.rpm
- # # Fedora 16 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-16.rpm
- # # Fedora 15 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-15.rpm
- # # Fedora 14 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-14.rpm
- # # Fedora 13 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-13.rpm
- # # Fedora 12 # #
- RPM-UVH http://rpms.famillecollet.com/remi-release-12.rpm
CentOS and Red Hat (RHEL) platforms
[Plain]View Plaincopy
- # # Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 # #
- RPM-UVH http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
- # # CentOS 6 and Red Hat (RHEL) 6 # #
- RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
- # # Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 # #
- RPM-UVH http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
- # # CentOS 5 and Red Hat (RHEL) 5 # #
- RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step3. View MySQL version number Fedora 17, 16, 15, 14, 13, 12
[Plain]View Plaincopy
- Yum--enablerepo=remi list MySQL Mysql-server
CentOS 6.2/6.1/6/5.8 and Red Hat (RHEL) 6.2/6.1/6/5.8
[Plain]View Plaincopy
- Yum--enablerepo=remi,remi-test list MySQL Mysql-server
Output:
[Plain]View Plaincopy
- Loaded Plugins:changelog, Fastestmirror, Presto, Refresh-packagekit
- ...
- Remi | 3.0 KB 00:00
- remi/primary_db | 106 KB 00:00
- Available Packages
- mysql.i686 5.5.25-1.fc14.remi @remi
- mysql-server.i686 5.5.25-1.fc14.remi
Step4. Install or upgrade to MySQL5.5.25
Fedora 17, 16, 15, 14, 13, 12
[Plain]View Plaincopy
- Yum--enablerepo=remi install MySQL Mysql-server
CentOS 6.2/6.1/6/5.8 and Red Hat (RHEL) 6.2/6.1/6/5.8
[Plain]View Plaincopy
- Yum--enablerepo=remi,remi-test install MySQL Mysql-server
Step5. Turn on the MySQL service and configure the self-boot
Fedora 17/16
[Plain]View Plaincopy
- Systemctl Start Mysqld.service
- Systemctl Enable Mysqld.service
Fedora 15/14/13/12/11, CentOS 6.2/6.1/6/5.8 and Red Hat (RHEL) 6.2/6.1/6/5.8
[Plain]View Plaincopy
- /etc/init.d/mysqld start
- # # OR # #
- Service mysqld Start
- Chkconfig--levels 235 mysqld on
Step6. MySQL Security Settings
- Set (Modify) root password
- Delete anonymous user
- Disable root Telnet
- Delete Test Database Tests
- Overloaded Permissions Table
To enable MySQL security settings, enter the following command
[Plain]View Plaincopy
- /usr/bin/mysql_secure_installation
Output
[Plain]View Plaincopy
- Note:running all PARTS of this SCRIPT are RECOMMENDED for all MySQL
- SERVERS in PRODUCTION use! Please READ each STEP carefully!
- In order-to-log into MySQL-secure it, we\ ' ll need the current
- Password for the root user. If you\ ' ve just installed MySQL, and
- You haven\ ' t set the root password yet, the password would be blank,
- So, should just press ENTER here.
- Enter current password to root (enter for none):
- OK, successfully used password, moving on ...
- Setting The root password ensures that nobody can log into the MySQL
- Root user without the proper authorisation.
- Set root Password? [y/n] Y
- New Password:
- Re-enter new password:
- Password Updated successfully!
- Reloading privilege tables.
- ... success!
- By default, a MySQL installation have an anonymous user, allowing anyone
- To log into MySQL without has to has a user account created for
- them. This was intended only for testing, and the installation
- Go a bit smoother. You should remove them before moving into a
- Production environment.
- Remove anonymous users? [y/n] Y
- ... success!
- Normally, Root should only is allowed to connect from ' localhost '. This
- Ensures that someone cannot guess at the root of password from the network.
- Disallow Root login remotely? [y/n] Y
- ... success!
- By default, MySQL comes with a database named ' test ' that anyone can
- Access. This was also intended only for testing, and should be removed
- Before moving into a production environment.
- Remove test database and access to it? [y/n] Y
- -Dropping test database ...
- ... success!
- -Removing privileges on test database ...
- ... success!
- Reloading the privilege tables would ensure that all changes made so far
- would take effect immediately.
- Reload privilege tables now? [y/n] Y
- ... success!
- Cleaning up ...
- All done! If you\ ' ve completed all of the above steps, your MySQL
- Installation should now is secure.
- Thanks for using mysql!
Note: If you do not want to start the MySQL security Settings command, but at least you have to change the root user password
[Plain]View Plaincopy
- mysqladmin-u root password [your_password_here]
- # # example # #
- Mysqladmin-u Root Password Myownsecrectpass
Step7. Connect a local database with a password
[Plain]View Plaincopy
- Mysql-u root-p
- # # OR # #
- Mysql-h Localhost-u Root-p
Step8. Specifies the user configuration for the specified database, specifying client (IP) remote access
The configuration parameters for this example are as follows
[Plain]View Plaincopy
- Db_name = WebDB
- user_name = Webdb_user
- REMOTE_IP = 10.0.15.25
- PASSWORD = password123
- PERMISSIONS = All
1. Create a database WebDB
[Plain]View Plaincopy
- mysql> CREATE DATABASE webdb;
2. Create User Webdb_user
[Plain]View Plaincopy
- mysql> CREATE USER ' webdb_user ' @ ' 10.0.15.25 ' identified by ' password123 ';
3. Authorization
[Plain]View Plaincopy
- Mysql> GRANT all on webdb.* to [email protected] ' 10.0.15.25 ';
4. Overloaded Permissions Table
[Plain]View Plaincopy
- mysql> FLUSH privileges;
Step9. Configure the firewall to turn on 3306 Port 1. To modify the/etc/sysconfig/iptables file:
[Plain]View Plaincopy
- Vi/etc/sysconfig/iptables
2. Add the following before commit:
[Plain]View Plaincopy
- -A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
3. Restart Iptables:
[Plain]View Plaincopy
- Service Iptables Restart
- # # OR # #
- /etc/init.d/iptables restart
4. Test the remote Access database on the client computer:
[Plain]View Plaincopy
- Mysql-h dbserver_name_or_ip_address-u webdb_user-p WebDB
********************************************
* Ye Wentao
* Link: Install MySQL 5.5* source in centos/red Hat (RHEL) 6.2/5.8 and Fedora 17/16: Install MySQL 5.5.25 on Fedora 17/16, centos/red Hat (RH EL) 6.2/5.8
Reprint please indicate source ***************
Install MySQL 5.5 with Yum (for centos6.2/5.8 and Fedora 17/16 platforms)