CentOs7安装mysql
yum install perl perl-devel cd /usr/local/src wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz tar zxvf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz mv mysql-5.6.40-linux-glibc2.12-x86_64 /usr/local/mysql useradd -s /sbin/nologin mysql 创建存放数据的目录: mkdir -p /data/mysql chown -R mysql:mysql /data/mysql/ 执行: cd /usr/local/mysql ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 配置文件: cp support-files/my-default.conf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld vim /etc/init.d/mysqld ,在配置里找到 basedir