随笔分类 -  MySQL

摘要:1:以root身份登陆mysql终端mysql -uroot -pmysql2:创建wx用户,注意密码要加单引号mysql> create user wx identified by 'wx';3:创建wx数据库mysql>create database wx;4:为用户wx授权使其拥有wx数据库的... 阅读全文
posted @ 2015-03-18 09:05 yshy 阅读(2006) 评论(0) 推荐(0)
摘要:>mysqldump -u用户名 -p密码 -h主机名 数据库名 > 20150116mw_pm_db.sqlmysql> source /home/y/my_work/20150116mw_pm_db.sql 阅读全文
posted @ 2015-01-16 07:48 yshy 阅读(134) 评论(0) 推荐(0)
摘要:1:修改my.cnf配置文件$sudo vim /etc/mysql/my.cnf修改为:bind-address = 0.0.0.02:进行授权操作mysql> grant all privileges on *.* to 'root'@'%' with grant option;Query OK... 阅读全文
posted @ 2014-12-09 09:58 yshy 阅读(210) 评论(0) 推荐(0)
摘要:1、如果为空返回0select ifnull(null,0)2、如果为空返回0,否则返回1select if(isnull(col),0,1) as col. 阅读全文
posted @ 2014-10-14 07:53 yshy 阅读(865) 评论(0) 推荐(0)
摘要:1:测试数据库表usermysql> desc user$$+-------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra ... 阅读全文
posted @ 2014-07-02 15:29 yshy 阅读(2036) 评论(0) 推荐(0)
摘要:需要以下jar包:---log4jcommons-loggin-1.1.1.jarlog4j-1.2.16.jar---mysqlmysql-connector-java-5.1.15-bin.jar---log4j.properties配置内容log4j.rootLogger=INFO,DATAB... 阅读全文
posted @ 2014-06-19 15:32 yshy 阅读(428) 评论(0) 推荐(0)
摘要:说明:在使用Tomcat6.0.32+Spring3.05+Quartz1.8.6+Mysql5.5.9 此项目在我本机上没有问题,当我把mysql 脚本导入到服务器上,将数据源配置修改为服务器对应的mysql时,再次运行程序出现以下问题,错误信息如下:严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCrea 阅读全文
posted @ 2014-03-24 10:19 yshy 阅读(5644) 评论(0) 推荐(0)
摘要:最近在使用quartz,在mysql中其数据库表中的时间都是使用bigint类型存储的,要想使其查询结果显示为yyyy-mm-dd hh:MM:ss的格式需要使用from_unixtime()函数,bigint类型不是时间戳类型,所以要除以1000转换为时间戳类型。select from_unixtime(start_time/1000) from qrtz_triggers 阅读全文
posted @ 2014-03-12 08:14 yshy 阅读(3932) 评论(0) 推荐(0)
摘要:#vim /etc/mysql/my.cnf找到[mysqld]添加character-set-server = utf8重启mysql#restart mysqlmysql> show variables like 'character%' ;+--------------------------... 阅读全文
posted @ 2014-01-28 16:06 yshy 阅读(841) 评论(0) 推荐(0)
摘要:内联接只显示在两个数据表里都能找到匹配的数据行。外联接除了显示同样的匹配结果,还可以把其中一个数据表在另一个数据表里没有匹配的数据行也显示出来。外联接分左联接和右联接两种。看下面的例子:内联接:左联接: 阅读全文
posted @ 2013-10-12 15:33 yshy 阅读(165) 评论(0) 推荐(0)
摘要:1:~/mysql_test/test.sql 1 create table student( 2 sno int not null primary key auto_increment, 3 sname varchar(20) not null 4 ) engine=MyISAM default charset=utf8;2:在控制台下执行。mysql> source ~/mysql_test/test.sqlQuery OK, 0 rows affected (0.07 sec)3:显示表student 的建表语句:mysql> show create table ... 阅读全文
posted @ 2013-10-12 14:57 yshy 阅读(843) 评论(0) 推荐(0)
摘要:1:sudo start mysql2:sudo stop mysql3:sudo restart mysql 阅读全文
posted @ 2013-10-12 13:46 yshy 阅读(855) 评论(0) 推荐(0)