电脑硬盘坏了,换了个新的,重新装软件,科科,说明备份是多么重要,一个四体不勤大脑不动的人,还是要会备份,然而这篇不讲备份。
部署环境,运行项目,发现提交上去的中文数据,存在mysql的居然是乱码,我知道是MySQL编码的问题。科科,别问我为什么知道,因为爱过。然而,怎么解决的,我什么都不记得了,继续问没有度娘的度娘。
1.首先,四个小时做的,我得想想。。。。。。
嗯,要干嘛呢,好难记起额。。。。。。
额,关闭mysql服务,打开my.ini配置,划重点,要把它剪切出去,修改完成,再把它移动回去,就可解决不可修改的问题。
修改编码如下:
[client]
port=3306
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8
2.然后,喵喵喵,我启动不了mysql服务了,然后作为一个大脑不动的懒鬼,我没有犹豫,马上百度,改了默认引擎
# The default storage engine that will be used when create new tables when
default-storage-engine=MYISAM
还开启了
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
skip-innodb
很好,可以启动。
3,但是我把MySQL Datafiles里的文件删了,把之前数据库里表给破坏了,手残还脑残,但是谁叫那就是我,我忍。但是导入sql文件,发现这样的错误
很庆幸,咩咩,我还会看错误日志,我居然知道去data文件夹下去看问题日志,自己都不会相信,科科
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
我知道数据库default-storage-engine要改回去了,但是改了我有启动不了
170306 18:38:32 InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 24 MB
InnoDB: Database physically writes the file full: wait...
170306 18:38:32 InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 24 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Cannot initialize created log files because
InnoDB: data files are corrupt, or new data files were
InnoDB: created when the database was started previous
InnoDB: time but the database was not shut down
InnoDB: normally after that.
可能是data和我修改的配置不匹配,才启动不了,我把data里的ibdata1,ib_logfile1,ib_logfile2,全删了,default-storage-engine改回去了关闭了skip-innodb
重启服务就好了。
(背景音乐:《童话镇》,真的好听,推荐)