mysql源码安装
安装环境
# yum -y remove mysql mysql-server cmake
# rm -rf /etc/my.cnf
# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make
Cmake:
# tar xvf cmake-2.8.11.2.tar.gz
# cd cmake-2.8.11.2.tar.gz
# ./bootstrap
# make && make install
# cmake -version
MySQL:
# groupadd mysql
# useradd -M -g mysql -s /sbin/nologin mysql
# tar xvf mysql-5.5.40.tar.gz
# cd mysql-5.5.40
# cmake \
-DCMAKE_INSTALL_PREFIX=/mnt/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/mnt/mysql/data \
-DINSTALL_MANDIR=/usr/share/man \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1
# make && make install
===MySQL初始化
# cd /mnt/mysql
# chown -R mysql:mysql .
# ./scripts/mysql_install_db --user=mysql --basedir=/mnt/mysql/ --datadir=/mnt/mysql/data
# cp support-files/my-huge.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
# source /etc/profile
[root@mysql mysql]# mysqladmin -uroot password 'mysql123'
[root@mysql mysql]# mysql -uroot -pmysql123
mysql> use mysql
mysql> select host,user,password from user;
mysql> update user set host='%' where user='root' and host='localhost';
mysql> flush privileges;
阅读(535) | 评论(0) | 转发(0) |