1:解压包及做链接 # tar xvf mysql-5.5.13-linux2.6-i686.tar.gz -C /usr/local # cd /usr/local # ln -sv mysql-5.5.13-linux2.6-i686 mysql # cd mysql --------------------------------------------------------------- 2:增加用户mysql及创建数据库数据存放目录/mydata/data # groupadd mysql # useradd -g mysql -s /sbin/nologin -M -r mysql # mkdir /mydata # cd /mydata # mkdir data # chown -R mysql:mysql /mydata ---------------------------------------------------------------- 3:初始化mysql的配置 # cd /usr/local/mysql # chown mysql:mysql . -R # scripts/mysql_install_db --user=mysql --datadir=/mydata/data # chown root . -R # cp support-files/my-large.cnf /etc/my.cnf # vim /etc/my.cnf ---------------------------------------------------------------- ## 在[mysqld]的字段添加如下一行: ---------------------------------------------------------------- datadir = /mydata/data ---------------------------------------------------------------- 4:启动mysql # cd /usr/local/mysql # bin/mysqld_safe --user=mysql & # netstat -nutlp |grep '3306' ---------------------------------------------------------------- 5:设置系统使其拥有mysql命令 # vim /etc/profile ---------------------------------------------------------------- ##最好在export字段其上添加一行: ---------------------------------------------------------------- PATH=$PATH:/usr/local/mysql/bin ---------------------------------------------------------------- # . /etc/profile ---------------------------------------------------------------- 6:加载库函数 # cd /etc/ld.so.conf.d/ # vim mysql.conf ---------------------------------------------------------------- 添加如下一行: ---------------------------------------------------------------- /usr/local/mysql/lib ---------------------------------------------------------------- # ldconfig -v # ln -sv /usr/local/mysql/include /usr/include/mysql # ls /usr/include/mysql ---------------------------------------------------------------- 7:把mysql加入开机启动 # cd /usr/local/mysql # cp support-files/mysql.server /etc/init.d/mysqld # chkconfig --add mysqld # chkconfig mysqld on # service mysqld start
mysql二进制文件编译_二进制编译安装mysql
最新推荐文章于 2021-02-08 01:47:21 发布