linux下mysql的使用
启动mysql: /etc/rc.d/init.d/mysql start
修改密码: 格式:mysqladmin -u用户名 -p旧密码 password 新密码
使用密码登录: mysql -u root -p
显示数据库: show databases;
选择数据库: use 数据库名;
显示表: show tables;
显示表结构: descibe 表名;
远程登录mysql需要开启权限:
grant 权限名(all表全部) on 库名(*表全部).表名(*表全部) to 用户名@"%"(%表全部IP) identified by "密码"
例如: grant all on *.* to root@"%" identified by "111111"
查看mysql的版本信息: \s
判断是否支持分区: show variables like '%partition%'
相关文档:
安装mysql
sudo apt-get install mysql-servel-5.0 mysql-client-5.0
下载安装过程中,会提示输入root密码
安装C语言编程接口:
sudo apt-get install libmysqlclient15-dev
更多api 查看:http://dev.mysql.com/doc/refman/5.0/en/c.html
相关mysql头文件和库文件安装在/usr/include/mysql/和/usr/lib/mysql目 ......
格式为2008-06-16
查询出当天数据:
SELECT * from `table` WHERE date(时间字段) = curdate();
查询出当月字段:
SELECT *
from `table`
WHERE month( 时间字段) = month( now( ) ) ;
时间格式为1219876…… UNIX时间,只要应用“from_UNIXTIME( )”函数
例如查询当月:
SELECT ......
很多朋友都有过这样的经历,将mysql升级到4.1(或以上)版本后,旧的程序从数据库读出来的都变成乱码了.这个问题网上很多这方面的讨论,其实手册上已经有关于这方面的详细说明,
以下内容摘自mysql手册,
产生这个问题的原因是:
MySQL 4.1.x开始支持以下这些事情
· 使 ......
by ZaraByte
How to do a SQL Injection for MYSQL Server 5.0+
1. Find a vulnerable add a ‘ at the end of the site example: news.php?id=1 add a ‘ at the end of the 1 and see if you get a syntax error
2. order by #–
Keep upping the # until you get an error.
3. union all select 1 ......