一、官網下載mysql
mysql
二、安裝依賴包c++
yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio yum install libaio libaio-devel -y yum install perl-Data-Dumper -y yum install net-tools -y
tar -zxvf mysql-5.6.40.tar.gz cd mysql-5.6.40
# 建立mysql用戶組 groupadd mysql useradd -g mysql mysql
三、編譯安裝mysqlsql
cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -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
3.一、執行初始化配置腳本ide
cd /usr/local/mysql scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
3.二、拷貝啓動腳本並啓動code
cp support-files/mysql.server /etc/init.d/mysql chkconfig mysql on service mysql start
四、登錄配置密碼server
vi /etc/profile #在末尾添加 PATH=/usr/local/mysql/bin:$PATH export PATH
source /etc/profile
blog
mysql -u root -p SET PASSWORD = PASSWORD('fan'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'fan' WITH GRANT OPTION;
至此mysql編譯安裝完成。ip