问 mysql格式化时间,mysql格式化时间全面讲解一下?
对mysql数据库做一下全面的时间格式化讲解。
对mysql数据库做一下全面的时间格式化讲解。
本站提供的Shiro Demo 数据库是Mysql。Demo地址来自:http://www.sojson.com/shiro
版本为‘5.6.20’。
安装可以看看这个:http://www.sojson.com/blog/196.html
安装完成后,使用命令行cmd进入安装路径bin目录下,我的目录为“D:\hn\mysql_5.6.24_winx64\bin”。
PS:注意点。
1.如果已经配置了Mysql的环境变量,可以不在mysql的bin目录下操作。
2.cmd窗口请用管理员模式运行,防止权限不足。不知道如何以管理员模式运行,请看这个里面有介绍: http://www.sojson.com/blog/196.html
用root帐号连上mysql,语句为“mysql -u root”即可,然后创建一个数据库,提示如下错误:
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'shiro_demo'。
原因是因为mysql数据库的user表里,存在用户名为空的账户即匿名账户,导致登录的时候是虽然用的是root,但实际是匿名登录的,通过错误提示里的''@'localhost'可以看出来。
由于网上大多是Linux下解决方案,但是在windows下输入命令却有不同,经过在网上查找试验,终于找到一个比较有效的方法,现整理如下:
1、cmd模式进入mysql的bin目录,输入D:\hn\mysql_5.6.24_winx64\bin>mysqld --defaults-file="D:\hn\mysql_5.6.24_winx64\my-default.ini" --console --skip-grant-tables,回车
PS:这里把你的mysql安装路径,替换我的"D:\hn\mysql_5.6.24_winx64"。
2014-08-29 10:40:48 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use
2014-08-29 10:40:48 8108 [Note] Plugin 'FEDERATED' is disabled.
2014-08-29 10:40:48 8108 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-08-29 10:40:48 8108 [Note] InnoDB: The InnoDB memory heap is disabled
2014-08-29 10:40:48 8108 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2014-08-29 10:40:48 8108 [Note] InnoDB: Memory barrier is not used
2014-08-29 10:40:48 8108 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-08-29 10:40:48 8108 [Note] InnoDB: Not using CPU crc32 instructions
2014-08-29 10:40:48 8108 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-08-29 10:40:48 8108 [Note] InnoDB: Completed initialization of buffer pool
2014-08-29 10:40:48 8108 [Note] InnoDB: Highest supported file format is Barracuda.
2014-08-29 10:40:57 8108 [Note] InnoDB: 128 rollback segment(s) are active.
2014-08-29 10:40:57 8108 [Note] InnoDB: Waiting for purge to start
2014-08-29 10:40:57 8108 [Note] InnoDB: 5.6.20 started; log sequence number 1625997
2014-08-29 10:40:57 8108 [Note] Server hostname (bind-address): '*'; port: 3306
2014-08-29 10:40:57 8108 [Note] IPv6 is available.
2014-08-29 10:40:57 8108 [Note] - '::' resolves to '::';
2014-08-29 10:40:57 8108 [Note] Server socket created on IP: '::'.
2014-08-29 10:40:58 8108 [Note] mysqld: ready for connections.
Version: '5.6.20' socket: '' port: 3306 MySQL Community Server (GPL)
看到这个结果就说明MySQL已经起来了。
2、再开一个dos窗口(重要),同样切到mysql bin目录下, D:\hn\mysql_5.6.24_winx64 \bin>mysql -u root mysql,再回车
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20 MySQL Community Server (GPL)
mysql>
已连接上mysql数据库,可以输入mysql命令了。
3、设置密码
mysql> update user set password=PASSWORD('你的新密码') where user='root';
提示如下成功:
Query OK, 2 rows affected (0.02 sec)
Rows matched: 3 Changed: 2 Warnings: 0
再刷新(重要):
mysql> FLUSH PRIVILEGES;
再退出:
mysql> quit
好了,你可以正常使用了。记得是新密码。
Oracle有decode()函数,mysql我没找到,请问怎么写?
Discuz! Database Error
(2002) notconnect
出现这个问题,原因就是Mysql连接数过少了。
如果是空间,联系空间服务商。
如果是自己的服务器,自己调整下:max_connections=2000, 具体数量自己衡量,翻一倍,哈哈就解决了。
max_connections 在MySQL配置文件my.ini 或 my.cnf的参数max_connections,将其改为max_connections=1000,然后重启MySQL即可。但是有一点最难的就是my.ini这个文件在哪找。通常有两种可能,一个是在安装目录下(这是比较理想的情况),另一种是在数据文件的目录下,安装的时候如果没有人为改变目录的话,一般就在C:/ProgramData/MySQL往下的目录下。