MySQL official website:http://downloads.mysql.com/archives/community/
Select the x64 source installation package to download:
Place the installation file under/usr/local/src/
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/83/92/wKioL1d2PczCwAvBAAA-p8CmLmk401.png-wh_500x0-wm_3 -wmp_4-s_1593031234.png "title=" M2.png "alt=" Wkiol1d2pczcwavbaaa-p8cmlmk401.png-wh_50 "/>
Uninstall and delete MySQL original related content:
Userdel-r MySQL
Groudel MySQL
Find/-name "MySQL"-exec rm-rf {} \;
New MySQL user, user group:
Groupadd MySQL
Useradd-s/sbin/nologin-g MySQL MySQL
Unzip the file and give the folder the appropriate permissions:
Cd/usr/local/src
TAR-ZXVF mysql-5.1.40-linux-x86_64-glibc23.tar.gz
MV Mysql-5.1.40-linux-x86_64-glibc23/usr/local/mysql
Chmod-r 755/usr/local/mysql
Chown-r Mysql.mysql/usr/local/mysql
To create a separate data installation file:
Mkdir-p/data/mysql
Chmod-r 755/data/
Chown-r Mysql.mysql/data/mysql
To start installing the database:
CD /usr/local/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
echo $?
Returning 0 indicates that the installation was successful.
Copy the boot configuration file
CP Support-files/mysql.server/etc/init.d/mysqld
chmod 755/etc/init.d/mysqld
modifying startup scripts
Vi/etc/mysql.dmysqld
Find the value of the DataDir variable, modify the value of the variable so that subsequent files are stored in their own specified directory.
Datadir=/data/mysql
Add the startup script to the system service entry and set the start to start, MySQL
Chkconfig--add mysqld
Chkconfig mysqld on
Service mysqld start;
To add an environment variable:
echo "Export Mysql_path=/usr/local/mysql" >> ~/.bash_profile
echo "Export path= $PATH: $MYSQL _path/bin" >> ~/.bash_profile
source. bash_profile
To change the root password:
Mysqladmin-uroot Password 123456
Log in to the MySQL server:
mysql-uroot-p123456
The single instance MySQL installation is complete at this time.
This article is from the "less stubborn" blog, please be sure to keep this source http://xushaojie.blog.51cto.com/6205370/1795018
centos6.5 installing Single Instance MySQL