I. Preparations
Note: because it is installed on a server that already exists and has been used by multiple parties, you must first confirm whether Mysql has been installed on this Linux server.
1. When groupadd mysql, the system prompts that mysql already exists and useradd-g mysql also prompts that mysql already exists. Basically, you can confirm that mysql has been installed;
Switch to mysql to view the mysql process. If no result is displayed, the current mysql is not started;
When mysql start is input, an ERROR occurs: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2). Do not study this error first. Prepare to reinstall mysql.
Enter rpm-qa | grep mysql. No information is displayed. If this method is not used, you do not need to uninstall it and directly install it.
2. Confirm the system environment:
Enter the command: uname-a to obtain the following information: Linux localhost. localdomain 2.6.9-55. ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux, www.bkjia.com indicates that the system is 32 bits;
3. Download the MySQL installation package:
Download the corresponding installation package from the official website (My mysql-5.1.51-linux-i686-glibc23.tar.gz );
Ii. Installation
1. Create a mysql group and user (created, skipped );
2. Use the root user to authorize the mysql installation path and execute the following commands in sequence:
MYSQL_BASE =/opt/mysql
Mkdir-p $ MYSQL_BASE/product/5.1
Mkdir-p $ MYSQL_BASE/mysqldata/mysqllog
Mkdir-p/var/run/mysqld/
Mkdir-p/etc/mysql
Chmod-R 777 $ MYSQL_BASE
Chown-R mysql: mysql $ MYSQL_BASE
Chown-R mysql: mysql/etc/mysql
Chown-R mysql: mysql/var/run/mysqld/
Note: The above path is the path for mysql installation. Some paths are related to the actual environment.