小小DBA一枚
2015年(4)
分类: Mysql/postgreSQL
2015-03-06 06:07:24
安装编译源码所需要的工具包
Shell >> yum install gcc gcc-c++ ncurses-devel perl
安装编译工具cmake
Shell >> wget
Shell >> tar -zxvf cmake-2.8.10.2.tar.gz
Shell >> cd cmake-2.8.10.2
Shell >> ./bootstrap;make;make install
创建MySQL 用户、用户组
Shell >> groupadd mysql
Shell >> useradd -g mysql mysql
Shell >> mkdir /usr/local/mysql
cmake
\
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
\
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1
\
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
Chown -R mysql.mysql /opt/mysql/mysql56
根据自己需求修改配置文件
./scripts/mysql_install_db --defaults-file=/etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
Shell >> vim /etc/profile
添加 PATH=/usr/local/mysql/bin:$PATH
EXPORT PATH
Shell >> source /etc/profile
Shell >> mysqld_safe --defaults-file=/etc/my.cnf --start
Shell >> chkconfig list |grep mysql
Shell >> chkconfig mysql off
Shell >> ps aux|grep mysql
Shell >> mysql -uroot
Mysql >> SET PASSWORD = PASSWORD(****);