Mysql 安裝編譯5.5.22
阿新 • • 發佈:2018-11-24
1 [[email protected] ~]# yum -y install ncurses-devel # 安裝外掛 2 [[email protected] ~]# tar xf cmake-2.8.6.tar.gz -C /usr/src/ # 解壓cmake軟體包 3 [[email protected] ~]# cd /usr/src/cmake-2.8.6/ 4 [[email protected] cmake-2.8.6]# yum -y install gcc gcc-c++ make autoconf # 安裝解壓外掛5 [[email protected] cmake-2.8.6]# ./configure && gmake && gmake install # 編譯安裝cmake 6 [[email protected] ~]# tar xf mysql-5.5.22.tar.gz -C /usr/src/ # 解壓mysql 軟體包 7 [[email protected] ~]# cd /usr/src/mysql-5.5.22/ 8 [[email protected] mysql-5.5.22]# cmake -DCMAKE_INSTALL_PREIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all && make && make install # 編譯安裝mysql9 [[email protected] mysql-5.5.22]# useradd -M -s /sbin/nologin mysql # 建立mysql程式使用者 10 [[email protected] mysql-5.5.22]# chown -R mysql:root /usr/local/mysql/ # 給mysql設定許可權 11 [[email protected] mysql-5.5.22]# /bin/cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf # 呼叫配置檔案,修改配置檔案12 [[email protected] mysql-5.5.22]# /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld # 呼叫配置檔案,修改配置檔案 13 [[email protected] mysql-5.5.22]# chmod +x /etc/init.d/mysqld # 給mysql加許可權 14 [[email protected] mysql-5.5.22]# chkconfig mysqld --add # 加入開機啟動項 15 [[email protected] mysql-5.5.22]# ln -s /usr/local/mysql/bin/* /usr/local/bin/ # 建立軟連線讓系統可以找到mysql 16 [[email protected] mysql-5.5.22]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ # 格式化資料庫data目錄 17 [[email protected] ~]# /etc/init.d/mysqld start # 啟動MySQL 18 Starting MySQL.. SUCCESS! 19 [[email protected] ~]# mysqladmin -uroot password '123456' # 設MySQL登陸密碼
安裝完畢,現在可以登陸MySQL開始正常使用