Centos 6.x 源码安装 Mysql 5.6.17
这里直接列出全部过程,按照过程操作即可
groupadd mysql useradd -s /bin/false -g mysql mysql cd /usr/local/src/ wget https://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.15.tar.gz tar zxvf mysql-5.6.15.tar.gz cd mysql-5.6.15 cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DWITH_EXTRA_CHARSETS=all \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DSYSCONFDIR=/usr/local/mysql \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DMYSQL_TCP_PORT=3306 \ -DENABLE_DTRACE=0 make && make install cd /usr/local/mysql/ ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data ln -s my.cnf /etc/my.cnf cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld chmod 755 /etc/rc.d/init.d/mysqld vim /etc/rc.d/init.d/mysqld 46 行basedir=/usr/local/mysql 47 行datadir=/usr/local/mysql/data service mysqld start chkconfig mysqld on vim /etc/profile #添加这一行 export PATH=$PATH:/usr/local/mysql/bin source /etc/profile mysql_secure_installation #按照如下操作 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): 此处只需按下回车键 OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y (要为root管理员设置数据库的密码) New password: 输入要为root管理员设置的数据库密码 Re-enter new password: 再输入一次密码 Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y (删除匿名账户) ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y (禁止root管理员从远程登录) ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y (删除test数据库并取消对其的访问权限) - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y (刷新授权表,让初始化后的设定立即生效) ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up...