標籤:
---恢複內容開始---
linux版本:CentOS7 64位
1、現在安裝包“mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz”
2、把下載的安裝包移動到/usr/local/下。
3、解壓
tar zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
4、添加系統mysql組和mysql使用者
1 groupadd mysql2 useradd -r -g mysql mysql
5、修改目前的目錄擁有者為mysql使用者
chown -R mysql:mysql ./
6、安裝資料庫,此處可能出現錯誤。
./scripts/mysql_install_db --user=mysql
錯誤資訊:./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
原因:沒有/usr/bin/perl檔案或者檔案。
解決辦法:(安裝perl跟perl-devel即可)
yum -y install perl perl-devel
錯誤資訊:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
Data::Dumper
解決方案 :安裝autoconf庫,此包安裝時會安裝Data:Dumper模組
yum -y install autoconf
7、修改目前的目錄擁有者為root使用者
chown -R root:root ./
8、修改當前data目錄擁有者為mysql使用者
chown -R mysql:mysql data
============== 到此資料庫安裝完畢 =============
9、啟動mysql服務和添加開機啟動mysql服務
添加開機啟動,把啟動指令碼放到開機初始化目錄。
cp support-files/mysql.server /etc/init.d/mysql
10、啟動mysql服務
service mysql start
錯誤資訊:
/etc/init.d/mysql: line 256: my_print_defaults: command not found
/etc/init.d/mysql: line 276: cd: /usr/local/mysql: No such file or directory
Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
==========
/usr/local/mysql-5.6.33-linux-glibc2.5-x86_64
---恢複內容結束---
linux下安裝Mysql