本文共 1854 字,大约阅读时间需要 6 分钟。
安装mysql的方法很多,但是我最喜欢就是yum,因为简单又无脑。
那么首先要#rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm,然后#yum install mysql-community-server,进行安装,这个安装的版本是5.6社区版。
安装完毕之后,发现#service mysqld start无法启动,如图:
这个时候就去查看一下mysql的错误日志,#less /var/log/mysqld.log,发现里面有这样的话:
1 2 3 4 5 6 | [ERROR] InnoDB: auto-extending data file . /ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file : initial 768 pages, max 0 (relevant if non-zero) pages! 2017-09-01 14:26:55 29830 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data! 2017-09-01 14:26:55 29830 [ERROR] Plugin 'InnoDB' init function returned error. 2017-09-01 14:26:55 29830 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2017-09-01 14:26:55 29830 [ERROR] Unknown /unsupported storage engine: InnoDB 2017-09-01 14:26:55 29830 [ERROR] Aborting |
出现这个错误的原因是:MySQL5.5.8 GA默认引擎为InnoDB,而配置文件(my.cnf)中设置了skip-innodb,遇到这种问题有两种方法,一个是在my.cnf里的内容改成这样:
1 2 | #loose-skip-innodb default-storage-engine = MyISAM |
还有一种方法比较残忍,就是#rm -rf /var/lib/mysql/ib*,把ibdata1、ib_logfile0、ib_logfile1文件全部删除掉,然后重新#service mysqld start 一下,如图:
启动完毕之后,需要#mysql_upgrade一下,如图:
然后再#mysql_secure_installation,里面输入root的新密码,然后在“Remove anonymous users? [Y/n]” 这一步选择Y,意思是干掉所有的匿名用户。
全部搞定之后,#chkconfig mysqld on,设置开机自动启动mysql:
#mysql -V 查看一下版本是5.6,至此整个mysql 5.6就全部安装完成了,enjoy it。
最后的最后,如果您觉得本文对您升职加薪有帮助,那么请不吝赞助之手,刷一下下面的二维码,赞助本人继续写更多的博文!
本文转自 苏幕遮618 51CTO博客,原文链接:http://blog.51cto.com/chenx1242/1961930
转载地址:http://aivwx.baihongyu.com/