系統爲Centos6.2 mysql-5.5.23
#bin/mysql_install_db 提示找不到目錄和文件
不過經網友提醒,mysql_install_db 在mysql-5.5後改到/usr/local/mysql-5.5.23/scripts/mysql_install_db
在我執行又出現以下錯誤了
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
groupadd mysql #添加mysql組
useradd -g mysql mysql -s /bin/false #創建用戶mysql並加入到mysql組,不允許mysql用戶直接登錄系統
mkdir -p /data/mysql #創建MySQL數據庫存放目錄
chown -R mysql:mysql /data/mysql #設置MySQL數據庫目錄權限
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #拷貝配置文件
vi /etc/my.cnf #編輯配置文件,在 [mysqld] 部分增加
datadir = /data/mysql #添加MySQL數據庫路徑
./scripts/mysql_install_db --user=mysql #生成mysql系統數據庫
以這個方法把數據庫初始化了