答辩系统bug修改记录
1.验证码不显示
参考Could not initialize class sun.awt.X11GraphicsEnvironment解决
在catalina.sh里加上一句 “CATALINA_OPTS=-Djava.awt.headless=true”,问题解决。
2.数据库备份不成功
参考linux的mysql权限错误导致看不到mysql数据库
[root@localhost ~]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
只显示这个两个数据库,看不到mysql数据库
解决方法:
此问题实际上是用户没有权限:
1. 关闭mysql,service mysqld stop
2. 启动mysql: mysqld_safe --skip-grant-tables
3. 再打开一个ssh连接服务器,进行mysql操作
[root@localhost ~]#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>show databases;
在这个模式下是可以看到mysql数据库的。
4.切换数据库:use mysql
5.显示所有的表:show tables;这里就可以访问表了
6.查看user表中root用户的localhost权限:select * from user where user='root' and host='localhost';
7.在显示的列表中显示:root用户的localhost的权限都是'N',表示root用户本地登陆不具有权限
8.修改root用户的localhost权限:
update user set `Select_priv` = 'Y', `Insert_priv` = 'Y', `Update_priv` = 'Y', `Delete_priv` = 'Y', `Create_priv` = 'Y', `Drop_priv` = 'Y', `Reload_priv` = 'Y', `Shutdown_priv` = 'Y', `Process_priv` = 'Y', `File_priv` = 'Y', `Grant_priv` = 'Y', `References_priv` = 'Y', `Index_priv` = 'Y', `Alter_priv` = 'Y', `Show_db_priv` = 'Y', `Super_priv` = 'Y', `Create_tmp_table_priv` = 'Y', `Lock_tables_priv` = 'Y', `Execute_priv` = 'Y', `Repl_slave_priv` = 'Y', `Repl_client_priv` = 'Y', `Create_view_priv` = 'Y', `Show_view_priv` = 'Y', `Create_routine_priv` = 'Y', `Alter_routine_priv` = 'Y', `Create_user_priv` = 'Y', `Event_priv` = 'Y', `Trigger_priv` = 'Y' where user='root' and host='localhost' //这里需注意是否有这个条件的用户9.更新一下:flush privileges;10.然后重新启动下mysql,则问题解决:service mysqld start
3.mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
说明密码不对,我的原因是-p后面多一个空格,去掉就可以了
4.命令积累
(1)linux备份和还原mysql数据库
备份:mysqldump -uroot -proot defensys --skip-lock-tables > /home/tms/DefDataBack/back_1008.sql
还原:mysql -uroot -proot defensys < back_1008.sql
注意-u和-p后无空格
(2)删除文件和目录的命令: rm -f, --force 忽略不存在的文件,从不给出提示。-r, -R, --recursive 指示rm将参数中列出的全部目录和子目录均递归地删除。
rm -rf test 删除test文件夹及其子目录
(3)查看数据库:
mysql -uroot -proot 进入
show databases;显示所有数据库
exit;退出
(4)查看tomcat运行日志
在logs文件夹下:tail -f catalina.out
(5)修改tomcat编码 tomcat下的conf/server.xml
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
参考:http://blog.csdn.net/numbibi/article/details/7987883
20151007晚