MySQL 编译安装
安装 cmake
sudo ./configure --prefix=/usr/local/cmake
安装 ncurses-devel 依赖
yum -y install ncurses-devel
防止编译时内存不足
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile
After compiling, you may wish to
Code:
sudo swapoff /swapfile
sudo rm /swapfile
配置安装参数
进入源码包
mkdir bld
cd bld
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/data/mysql
-DSYSCONFDIR=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DWITH_BOOST=DIR
安装完成后的配置
cd /usr/local/mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql 初始化
配置和启动服务器
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
登录 MySQL,修改密码
bin/mysql -uroot -p
msyql>set PASSWORD = Password("密码")
mysql>flush privileges
网友评论