Install mysql5 in Red Hat Enterprise Linux 4

Source: Internet
Author: User

Uninstall the old MySQL version on Redhat. On as4.

1> use "rpm-Qa | grep MySQL" to check which components of MySQL are installed. Check which component names are available and use them in step 2 Uninstall.

2> use "rpm-evv <component name>" to completely uninstall the service. some of the components are missing ***. for so.10, you need to use "rpm-e -- nodeps <component name>" to force Uninstall. the uninstallation has been completed. 0jaq 'k7q |-H

Linux inventory

2. Install mysql5.

1> important! Disable SELinux. otherwise, MySQL cannot be connected successfully during installation. close method: Change SELinux = enforcing to SELinux = disabled in/etc/SELinux/config. restart and run the sestatus command to confirm that SELinux is disabled.

2> download the RPM package of mysql5 (Www.mysql.com). My machine is Red Hat Enterprise Linux 4 rpm (x86). Therefore, download the corresponding server and client in the corresponding section.

3> use "rpm-IVH <File Name>" to install the server, and then use "rpm-IVH <File Name>" to install client. Linux 0yu

4> restart MySQL with "service MySQL restart". Check whether the installation is successful.

5> set the root password, go to the/usr/bin directory, and run "mysqladmin-u root-P password 123456". 123456 indicates your password, and the system prompts you to enter the old password. restart MySQL with "service MySQL restart.

6> test: Use "mysql-H localhost-u root-P" to log on to the MySQL database. Use "show databases;" to view the database. MySQL 5 has been installed.

3. Remote Access Management.

MySQL can only be accessed from the local machine by default. If you need remote access from other machines, you need to set it.

1> Add a user for remote login. log on to MySQL using localhost in Method 6 and execute the SQL statement "grant all privileges on *. * To 'myuser' @ '%' identified by 'mypassword' with grant option; "add the username myuser and password mypassword. "%" indicates that all machines are accessible. use method 4 to restart MySQL.

2> after that, you can log on to MySQL using the command "mysql-H <IP address of your machine>-u myuser-P" on the local machine. The setting is successful.

3> most importantly. at this time, you can find that you can connect to MySQL on this machine. however, if you use the same method on other machines, "can't connect to MySQL server on '9. 186.100.178 '(10065) "error. the cause is caused by the as4 firewall. set the firewall using the following method: open the file/etc/sysconfig/iptables and add one before the last one: -A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3306-J accept. then run/etc/init. d/iptables restart. so far, the as4 firewall has been set up.

Now, you can access the database with the mysql client on another machine. The login method is "mysql-H <ip>-u myuser-P ". however, if you are always using this console for management, it is recommended that you use some management software for management. I am using MySQL-front and very good software. try it. if you have any questions, please point out, thank you!

6. Start and Stop

1. Start
After MySQL is installed, run the following command to start MySql in the/etc/init. d directory.
[Root @ test1 init. d] #/etc/init. d/MySQL start

2. Stop
/Usr/bin/mysqladmin-u root-P Shutdown

3. Automatic Start
1) Check whether MySQL is in the Auto Start List
[Root @ test1 local] #/sbin/chkconfig -- list
2) Add MySQL to the startup Service Group of your system.
[Root @ test1 local] #/sbin/chkconfig -- add MySQL
3) Delete MySQL from the startup Service Group.
[Root @ test1 local] #/sbin/chkconfig -- del MySQL

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.