1.安装Server与Client

./configure --prefix=/usr/local/mysql \--localstatedir=/data/mysql --enable-assembler \--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static \--with-pthread --enable-static --with-big-tables --without-ndb-debug \--with-charset=utf8 --with-extra-charsets=all \--without-debug --enable-thread-safe-client --enable-local-infile --with-plugins=max
2.安装客户端
./configure --without-server \--with-extra-charsets=gbk,gb2312,utf8 \--enable-thread-safe-clientmake && make install
3.安装Server
./configure --prefix=/usr/local/mysql \--localstatedir=/data/mysql \--with-extra-charsets=utf8,gb2312,gbk --with-pthread \--enable-thread-safe-client
4.Mysql 授权
mysql -e "create database zentao"mysql -e "grant all on zentao.* to zentao@'localhost' identified by '123456'"grant all on *.* to mysql@'localhost' identified by '123456';grant all on *.* to root@"%" identified by "123456";grant all on *.* to free@"%" identified by "123456";flush privileges;
5. 创建用户和组
groupadd mysqluseradd -s /sbin/nologin -M -g mysql mysql
6. 安装数据库
cd /usr/local/mysql/ mkdir -p /data/mysql/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql
7.相应权限的修改
chown -R root:mysql /usr/local/mysql/chown -R mysql:mysql /data/mysql/
8.配置文件
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnfcp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqldchkconfig --add mysqldvim /root/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/mysql/binsource /root/.bash_profile
9.启动数据库并初始化密码
service mysqld startmysqladmin -u root -p password "123456"set password for 'root'@'localhost' =password('123456');flush privileges;