安装mysql,安装前准备如果mysql用户不存在,那么添加mysql用户groupadd mysqluseradd -g mysql mysqlmysql编译安装tar -zxvf mysql-5.1.73.tar.gzcd mysql-5.1.73yum install ncurses ncurses-devel./configure '--prefix=/usr/local/mysql' '--without-debug' '--with-charset=utf8' '--with-extra-charsets=all' '--enable-assembler' '--with-pthread' '--enable-thread-safe-client' '--with-mysqld-ldflags=-all-static' '--with-client-ldflags=-all-static' '--with-big-tables' '--with-readline' '--with-ssl' '--with-embedded-server' '--enable-local-infile' '--with-plugins=innobase'makemake install到此mysql就安装到了/usr/local/mysql路径下,下面开始mysql的配置工作安装mysql选项文件cp support-files/my-medium.cnf /etc/my.cnfcp -r support-files/mysql.server /etc/init.d/mysqld /sbin/chkconfig --del mysqld/sbin/chkconfig --add mysqld配置权限表chown -R mysql:mysql /usr/local/mysql/usr/local/mysql/bin/mysql_install_db --user=mysql启动mysql给/etc/init.d/mysql 执行权限,然后运行chmod a+wrx /etc/init.d/mysql/etc/init.d/mysqld startmysql初始化配置:包括密码设置等export PATH=/usr/local/mysql/bin:$PATH/usr/local/mysql/bin/mysql_secure_installation 在弹出的对话框中要求输入密码:Enter current password for root (enter for none):默认打回车,然后重新设置root密码:Set root password? [Y/n] yDisallow root login remotely? [Y/n] nRemove test database and access to it? [Y/n] nReload privilege tables now? [Y/n] y至此,Mysql运行成功