确认操作系统信息
cat /etc/redhat-release
uname -r
uname -m
安装cmake
tar xf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install
3、依赖包安装
yum install ncurses-devel -y
开始安装mysql
创建用户和组
groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql
解压编译MySQL
tar zxf mysql-5.5.32.tar.gz
cd mysql-5.5.32
mkdir -p /application/mysql-5.5.32
编译:
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \
-DMYSQL_DATADIR=/application/mysql-5.5.32/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MYISAM_STORAGE_ENGINE=1 \
-DWITHOUT_MEMORY_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
安装:
make && make install
创建连接
ln -s /application/mysql-5.5.32/ /application/mysql
创建参数文件
cp /root/tools/mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
修改文件夹权限
chown -R mysql.mysql /application/mysql
chmod -R 1777 /tmp
初始化mysql
cd /application/mysql/scripts/
./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
示例:
[21:10:35][root@mysql scripts]# ./mysql_install_db --basedir=/application/mysql-5.5.32/ --datadir=/application/mysql-5.5.32/data/ --user=mysql
[21:12:17]WARNING: The host 'mysql' could not be looked up with resolveip.
[21:12:17]This probably means that your libc libraries are not 100 % compatible
[21:12:17]with this binary MySQL version. The MySQL daemon, mysqld, should work
[21:12:17]normally with the exception that host name resolving will not work.
[21:12:17]This means that you should use IP addresses instead of hostnames
[21:12:17]when specifying MySQL privileges !
[21:12:17]Installing MySQL system tables...
[21:12:17]OK
[21:12:17]Filling help tables...
[21:12:17]OK
[21:12:17]
[21:12:17]To start mysqld at boot time you have to copy
[21:12:17]support-files/mysql.server to the right place for your system
[21:12:17]
[21:12:17]PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
[21:12:17]To do so, start the server, then issue the following commands:
[21:12:17]
[21:12:17]/application/mysql-5.5.32//bin/mysqladmin -u root password 'new-password'
[21:12:17]/application/mysql-5.5.32//bin/mysqladmin -u root -h mysql password 'new-password'
[21:12:17]
[21:12:17]Alternatively you can run:
[21:12:17]/application/mysql-5.5.32//bin/mysql_secure_installation
[21:12:17]
[21:12:17]which will also give you the option of removing the test
[21:12:17]databases and anonymous user created by default. This is
[21:12:17]strongly recommended for production servers.
[21:12:17]
[21:12:17]See the manual for more instructions.
[21:12:17]
[21:12:17]You can start the MySQL daemon with:
[21:12:17]cd /application/mysql-5.5.32/ ; /application/mysql-5.5.32//bin/mysqld_safe &
[21:12:17]
[21:12:17]You can test the MySQL daemon with mysql-test-run.pl
[21:12:17]cd /application/mysql-5.5.32//mysql-test ; perl mysql-test-run.pl
[21:12:17]
[21:12:17]Please report any problems with the /application/mysql-5.5.32//scripts/mysqlbug script!
配置主机名解析:
echo "192.168.125.130 mysql" >> /etc/hosts
配置启动服务:
/bin/cp /root/tools/mysql-5.5.32/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
启动:
/etc/init.d/mysqld start
netstat -lntup |grep 3306
配置开启启动
chkconfig mysqld on
配置密码
/application/mysql/bin/mysqladmin -u root password 'xxxxxx'
安全配置
delete from mysql.user where user='' or host='mysql'
操作系统字符集设置
vim /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"