1. Download the package
See how many bits of Linux are
Uname-i
x86_64 64-bit or i386 32-bit
Not installed wget using Yum installation
Yum Install Wget-y
Switch to the specified directory, and the package is downloaded to the directory
cd/usr/local/src/
64-bit download package usage
wget http://mirrors.sohu.com/mysql/mysql-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
32-bit download package usage
wget http://mirrors.sohu.com/mysql/mysql-5.1/mysql-5.1.73-linux-i686-glibc23.tar.gz
If you want to download other versions of MySQL, you can go to http://mirrors.sohu.com/mysql/
2. Initialization
Unzip
64 guests
Tar zxvf/usr/local/src/mysql-5.1. -linux-x86_64-glibc23.tar.gz
32 Guests
Tar zxvf/usr/local/src/mysql-5.1. -linux-i686-icc-glibc23.tar.gz
Move location plus Create directory
64 guests
MV mysql-5.1. -linux-x86_64-glibc23/usr/local/mysql
32 Guests
MV mysql-5.1. -linux-i686-icc-glibc23/usr/local/mysql
Build MySQL user, do not allow login
Useradd-s/sbin/nologin MySQL
Create a directory where the database files are stored
Mkdir-p/data/mysql
Change permissions
Chown-r Mysql:mysql/data/mysql
Errors that may occur during installation, it is recommended that Yum install the packages before installing MySQL
Error encountered:./bin/mysqld:error while loading shared Libraries:libstdc++.so.5:cannotopen shared object file:
Solutions
Yum install-y compat-libstdc++-
Error encountered:./scripts/mysql_install_db:./bin/my_print_defaults:/lib/ld-linux.so.2:badelf interpreter:no such file or Directory
Workaround:
The system version is not the same as the MySQL version. For example, the system is 64-bit, the download is 32-bit.
Install MySQL
Move to the specified directory
Cd/usr/local/mysql
Start installation
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
--user defines the owning master of the database
--datadir define where the database is installed
Run after installation is complete
echo $?
Feedback is 0 description of success, feedback is 1 error.
3. Configure MySQL
Copy the configuration file and rename it. Because the my.cnf file already exists, you can overwrite it directly.
CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
Copy the startup script file
CP Support-files/mysql.server/etc/init.d/mysqld
Modify Startup script Permissions
755 /etc/init.d/mysqld
4. Modify the startup script
If you have not installed Vim, use Yum to install
Yum Install Vim-y
Open the configuration script file
Vim/etc/init.d/mysqld
Need to put
basedir=DataDir=
Basedir defining the installation directory for MySQL
DataDir define the file storage directory for the MySQL database
Revision changed to
basedir=/usr/local/Mysqldatadir=/data/mysql
Add system service, set boot up MySQL
Chkconfig--add mysqld
Chkconfig mysqld on
Reboot to start MySQL
Service mysqld Start
Check if MySQL is started
PS aux |grep mysqld
LAMP 1.1 Mysql