发表于: 2017-04-03 21:38:38
3 1343
今天完成的任务:
Eclipse卡住了,重装的时候从“D:/”换到“D:/Program Files“,然后就悲剧了,错误不断,项目直接不能运行了。然后今天一天就成了不断卸载安装Mysql和排错的过程了。
1.mysql 重装后无法启动
mysql Access denied for user root@localhost
解决:
mysql> update user set authentication_string=password('123abc') where user='root'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
2.mysql--1146--报错
解决:
先找到数据库存放地址,即Data文件夹(复制留下来)
把所有的mysql卸载,注册表清空。
然后把mysql文件夹弄走(卸载不会清掉它,需手动,一般在C:\ProgramData下,是一个隐藏文件,需要查看下设置才可见)(可删除,或剪切走,以防万一)
重新安装mysql
如果数据库启动了先关闭它(关闭是(net stop mysql--在cmd中);启动是(net start mysql--在cmd中),这里也可以右键点计算机--管理--服务--找到mysql--右键-属性,设置关闭或启动。最好选择手动,不然开机自动启动耗费资源,电脑会卡)
然后把以前的数据库文件(自己需要的)(在Data文件夹下的,数据库名即文件夹名)复制到,新的数据库Data文件夹下(那些自带的数据库别动),
把新的Data下的那五个配置文件替换为以前老的文件(就是这五个文件auto.cnf,ib_buffer_pool,ib_logfile0,ib_logfile1,ibdata1)
重新启动数据库就可以了。
3.报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
解决:
mysql> SET PASSWORD = PASSWORD('wobushi369');
Query OK, 0 rows affected, 1 warning (0.09 sec)
mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
4.eclipse报错,运行AppTest.class测试类
Mon Apr 03 18:13:35 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'student.student' doesn't exist
### The error may exist in com/ptteng/mapping/studentMapper.xml
### The error may involve com.ptteng.mapping.studentMapper.getStudent-Inline
### The error occurred while setting parameters
### SQL: select * from student where id=?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'student.student' doesn't exist
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73)
at com.ptteng.test.AppTest.main(AppTest.java:31)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'student.student' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:62)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:78)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:120)
... 3 more
解决:mysql中的数据表失效或者不存在,重建student表。
明天的计划:
写一个数据管理类,运行插入数据,进行索引比较。复习springMVC,为任务二做准备。
遇到的问题:
从无到有的建立过程按照攻略就可以了,出了问题,重新搭建环境时候排除错误却更难,因为很少有参考的内容。需要自己一点一点摸索。网上的教程只是给了一条正确的过程,却没有告诉你为什么这么做,等到你因为一些原因,搭建的框架出了问题需要排错的时候,基础的薄弱就显示出来了。
收获:
今天一天对mysql的理解更深入了。它的环境配置远不是点击安装输密码那么简单。
评论