系统为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系统数据库
以这个方法把数据库初始化了
转载于:https://blog.51cto.com/coolwa/851307