1. First add a MySQL user who cannot log in without generating a home directory:
# useradd-s/sbin/nologin-m MySQL #-M is not generated home directory
2. Create a MySQL directory, change the owning group and the owning master for MySQL:
# mkdir-p/data/mysql
# chown-r Mysql:mysql/data/mysql #-R inheritance
3. Under/usr/local/src/, download the 64-bit MySQL package without compiling:
wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
# TAR-ZXVF Mysql-5.1.73-linux-x86_64-glibc23.tar.gz
# mv Mysql-5.1.73-linux-x86_64-glibc23/usr/local/mysql # # Move Rename
the 32 bits are as follows :HTTP://MIRRORS.SOHU.COM/MYSQL/MYSQL-5.1/ Mysql-5.1.73-linux-i686-glibc23.tar.gz
4. Initialize:
# Cd/usr/local/mysql
# ./scripts/mysql_install_db--user=mysql--datadir=/data/mysql # # Specify data user and data directory
5. Copy the configuration file:
# CD./support-files
# CP MY-LARGE.CNF/ETC/MY.CNF--covers the original my.cnf
# CP Mysql.server/etc/init.d/mysqld--If you encounter the option to overwrite, y can.
6. Modify the configuration parameters:
# vim/etc/init.d/mysqld # # Find the following content, fill the back of the section
Basedir=/usr/local/mysql
Datadir=/data/mysql
--: Wq
7. start MySQL
# Chkconfig--add Mysqld
# Chkconfig Mysqld on
#/etc/init.d/mysqld Start-->start succesful
# PS Aux|grep mysqld can view the process of mysqld.
Because the absolute path of the MySQL command is very long, it is necessary to add the directory where the MySQL command is located in the path:
# vim/etc/init.d/path.sh
#!/bin/bash
Export path= $PATH:/usr/local/mysql/bin/
: Wq
# source/etc/init.d/path.sh
This way, you can start MySQL directly by typing MySQL directly into the command line.
If you find an error, please leave a comment in the comments, thank you 、、、
This article is from the "Liemer_lius blog" blog, make sure to keep this source http://liemerlius.blog.51cto.com/10409683/1696831
installation of MySQL