安裝rz工具和wget工具:分別如下: sudo yum install lrzsz;yum install wget 安裝cmake編譯工具:rz -y 選擇下載的cmake工具上傳到伺服器中 安裝c、c++:yum -y install gcc-c++ 環境參數:Linux:Centos6.5, ...
安裝rz工具和wget工具:分別如下: sudo yum install lrzsz;yum install wget 安裝cmake編譯工具:rz -y 選擇下載的cmake工具上傳到伺服器中 安裝c、c++:yum -y install gcc-c++
環境參數:Linux:Centos6.5,cmake:2.8.8,mysql:5.6.12
1.下載cmake-2.8.8.tar
2.安裝cmake
tar xf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake && gmake install
3.下載mysql-5.6.35.tar
4.添加mysql用戶和組
groupadd mysql
useradd mysql -s /sbin/nologin -M -g mysql
5.安裝ncurses-devel
yum install ncurses-devel -y
6.解壓mysql
tar xf mysql-5.6.12.tar.gz
cd mysql-5.6.12
7.編譯mysql cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.12 \ -DMYSQL_DATADIR=/application/mysql-5.6.12/data \ -DMYSQL_UNIX_ADDR=/application/mysql-5.6.12/mysql.sock \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_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到63%左右出現錯誤: make[2]: * [storage/perfschema/unittest/pfs_connect_attr-t] Error 1 make[1]: * [storage/perfschema/unittest/CMakeFiles/pfs_connect_attr-t.dir/all] Error 2 則:cmake去掉-DWITH_PARTITION_STORAGE_ENGINE=1參數重新編譯 8.mysql安裝 make && make install
9.做軟連接 ln -s /application/mysql-5.6.12/ /application/mysql
10.mysql目錄授權 chown -R mysql:mysql /application/mysql-5.6.12/
11.相關文件 cd /application/mysql/support-files cp my-default.cnf /etc/my.cnf cp mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld
12.mysql初始化 cd /application/mysql/scripts/ ./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
報錯:-bash: ./mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
安裝perl-devel,yum install perl-devel
13.啟動mysql /etc/init.d/mysqld start
14.配置環境變數 echo 'export PATH=/application/mysql/bin:$PATH'>>/etc/profile source /etc/profile
15.登陸mysql,刪除無用配置,只保留如下,並刪除test資料庫
mysql> select user,host from mysql.user; +------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | root | localhost | +------+-----------+ mysql> drop database test;
16.配置登陸密碼 /application/mysql//bin/mysqladmin -u root password 'cancer'
17.設置mysql開機啟動 chkconfig mysqld on chkconfig --list mysqld