There are two options to install Mysql, one is the source code installation, the second is to install the binary surface of the compilation package, in order to save time to choose the second. The MySQL installation package can be downloaded on the MySQL website (http://dev.mysql.com/downloads/), with a choice of two versions of i686 and x86_64. I am used to downloading on the mirror website, such as Sohu's Open source Mirror website (http://mirrors.sohu.com).
Download Package
Compiler-Free binary packages look for glibc, which can be obtained by uname-i how many bits of Linux are.
[Email protected] ~]# cd/usr/local/src/[[email protected] ~]# wget HTTP://MIRRORS.SOHU.COM/MYSQL/MYSQL-5.1/ Mysql-5.1.73-linux-x86_64-glibc23.tar.gz
Initialize
[[email protected] src]# lsmysql-5.1.73-linux-x86_64-glibc23.tar.gz[[email protected]  SRC]# TAR -ZXVF MYSQL-5.1.73-LINUX-X86_64-GLIBC23.TAR.GZ[[EMAIL PROTECTED] SRC] # lsmysql-5.1.73-linux-x86_64-glibc23 mysql-5.1.73-linux-x86_64-glibc23.tar.gz[[email protected] src]# mv mysql-5.1.73-linux-x86_64-glibc23 /usr/local/mysql[[email protected] src]# useradd -s /sbin/nologin mysql //set up mysql users [[email protected] src]# cd / usr/local/mysql[[email protected] mysql]# mkdir -p /data/mysql //Create datadir, The database file will be placed in this area [[email protected] mysql]# chown -r mysql:mysql /data/mysql //Change permissions [[EMAil protected] mysql]# ls -dl /data/mysqldrwxr-xr-x 2 mysql mysql 4096 5 Month 17 14:49 /data/mysql[[email protected] mysql]# ./ Scripts/mysql_install_db --user=mysql --datadir=/data/mysql
--user defines the owner of the database,--datadir defines where the database is installed. If you see two "OK" instructions, the execution succeeds. I'm having a problem:
Installing MySQL system Tables..../bin/mysqld:error while loading shared libraries:libaio.so.1:cannot open shared objec T file:no such file or directory[[email protected] mysql]# yum install-y Libaio
Need to be resolved using Yum install-y Libaio.
Configure MySQL
Copy configuration file
[email protected] mysql]# CP support-files/my-large.cnf/etc/my.cnf
Copy the startup script file and modify its properties
[[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld[[email protected] mysql]# chmod 755/etc/ Init.d/mysqld
modifying startup scripts
[Email protected] mysql]# Vim/etc/init.d/mysqld
The place to change is Datadir=/data/mysql
[[email protected] mysql]# chkconfig--add mysqld[[email protected] mysql]# chkconfig mysqld on[[email protected] mysql]# Service mysqld startstarting MySQL. success!
If it does not start, check the error log under/data/mysql/, which is usually the hostname. Err. The command to check if MySQL starts is:
[[email protected] mysql]# ps aux |grep mysqldroot 4231 0.0 0.1 11304 1496 pts/1 s 16:00 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe -- datadir=/data/mysql --pid-file=/data/mysql/localhost.localdomain.pidmysql 4346 0.6 44.7 1011204 452716 pts/1 sl 16:00 0:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/ localhost.localdomain.err --pid-file=/data/mysql/localhost.localdomain.pidroot 4385 0.0 0.0 103320 904 pts/1 s+ 16:04 &Nbsp; 0:00 grep mysqld
This article is from the "Learn Notes for students" blog, please make sure to keep this source http://sanyisheng.blog.51cto.com/11154168/1795789
Lamp--1. Mysql Installation