linux下mysql解压安装过程(生产环境下centos redhat经过N轮使用)1.上传mysql-5.5.29-linux2.6-x86_64.tar.gz文件到opt目录2.进入opt目录解压文件#tar -zxvf mysql-5.5.29-linux2.6-x86_64.tar.gz3.建立mysql用户组#groupadd mysql4.建立mysql用户并加入mysql用户组#useradd mysql -g mysql -p 1234567890 -s /sbin/nologin -M5.建立软链接#ln -s mysql-5.5.29-linux2.6-x86_64 mysql6.(说明一下,以下的/opt/mysql/的路径要保持一致,如果是/opt/mysql那就都保持这个一致)#cd mysql#chown -R mysql .#chgrp -R mysql .#scripts/mysql_install_db --user=mysql --datadir=/opt/mysql/data/#chown -R root .#chown -R mysql data#cp support-files/my-medium.cnf /etc/my.cnf (128M内存)或者cp support-files/my-large.cnf /etc/my.cnf(512M内存)或者cp support-files/my-huge.cnf /etc/my.cnf (1-2G内存)或者cp support-files/my-innodb-heavy-4G.cnf /etc/my.cnf(4G内存) 在my.cnf文件修改端口等配置#vi /etc/my.cnf(1)、两个地方的3306端口,改成13316(2)、最大连接数 和 innodb_file_per_table设置.开启在# The MySQL server[mysqld]的末尾,加上max_connections=3100innodb_file_per_table=1#bin/mysqld_safe --user=mysql & 等几分钟再往下执行(回车)拷贝文件#cp support-files/mysql.server /etc/init.d/mysql然后修改/etc/init.d/mysql文件basedir=/opt/mysqldatadir=/opt/mysql/data往下看,这几个都改成这样(和解压安装的mysql路径关联):basedir=/opt/mysqlbindir=/opt/mysql/bindatadir=/opt/mysql/datasbindir=/opt/mysql/binlibexecdir=/opt/mysql/bin自动启动#chkconfig --add mysql #chkconfig mysql on停止#service mysql stop 如果报Punrecognized service错则:chmod 755 /etc/rc.d/init.d/mysql启动#service mysql start#cd ../初始化管理员root的密码#/opt/mysql/bin/mysqladmin -u root password '1234567890'让root帐号可以本地和远程连接使用#/opt/mysql/bin/mysql -u root -p输入初始好的密码1234567890mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "1234567890";mysql>flush privileges;创建其他账号mysql>GRANT ALL PRIVILEGES ON *.* TO abcd@"%" IDENTIFIED BY "abcd#123456";mysql>flush privileges;mysql>quit;查看mysql进程#ps -ef|grep mysql来来来,为自己点赞,已经完成,请继续加油。