#初始化环境检查# uname -r2.6.32-696.el6.x86_64# uname -mx86_64#添加mysql用户useradd -s /sbin/nologin mysql -M#下载安装mysql(此处安装的mysql为二进制方式安装,另外还有yum安装、源码安装等方式)wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.54-linux2.6-x86_64.tar.gztar xf mysql-5.5.54-linux2.6-x86_64.tar.gzmv mysql-5.5.54-linux2.6-x86_64 /usr/local/mysql-5.5.54ln -s /usr/local/mysql-5.5.54 /usr/local/mysqlchown mysql.mysql -R /usr/local/mysqlcd /usr/local/mysql/./scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql#修改mysqld_safe配置文件的默认安装路径sed -i 's#/usr/local/#xxxxx#g' mysqld_safe#拷贝mysql配置文件cp -a support-files/my-small.cnf /etc/my.cnf#启动mysql/usr/local/mysql/bin/mysqld_safe --user=mysql&#测试链接mysql/usr/local/mysql/bin/mysql#添加环境变量echo 'PATH="/usr/local/mysql/bin:$PATH"' >> /etc/profile;source /etc/profile#如果mysql 不是安装到/usr/local/下记得修改mysql启动文件的路径配置sed -i 's#/usr/local/#/xxxx#g' support-files/mysql.server#拷贝mysql启动脚本,赋予权限cp support-files/mysql.server /etc/init.d/mysqldchmod u+x /etc/init.d/mysqld#启动mysql/etc/init.d/mysqld restart#添加开机启动chkconfig --add mysqld#设置密码mysqladmin -u root password 'password'#修改密码mysqladmin -uroot -ppassword password 111111
以上为mysql的安装过程,此处为mysq的二进制安装方式。我比较喜欢。
mysql下载路径:
未完待续......
!!!如转载,请注明出处。多谢。