易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : mysql

MySQL的开源热备份工具Xtrabackup1.2

InnoDB,普通的mysql
dump备份下来,mysql恢复起来慢得要
死.
于是网上找了好久,才找到这么个工具
.
http://launchpad.net/percona-xtrabackup/release-1.2/release-1.2/+download/xtrabackup-1.2.tar.gz
先测试下再说.
可以这么备份:
MyISAM
表:
/usr/local/mysql/bin/mysqldump -uyejr -pyejr
--default-character-set=utf8 --opt --extended-insert=false /--triggers
-R --hex-blob -x db_name > db_name.sql
Innodb
表:
/usr/local/mysql/bin/mysqldump -uyejr -pyejr
--default-character-set=utf8 --opt --extended-insert=false /--triggers
-R --hex-blob --single-transaction db_name > db_name.sql ......

在mysql数据库中修改root的密码

下面我给大家介绍几种在mysql数据库中修改root密码的方法
方法一:
原始密码是 ckh
mysql -uroot -pckh
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.0.22-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> update user set password=password('newpass') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
方法二:
原始密码是 newpass , 新密码是  mysql
mysqladmin -uroot -pnewpass password mysql
方法三
原始密码是 mysql , 新密码是  ckh
mysql -uroot -pmysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 5.0.22-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> set password for root@'localhost'=password('ckh ......

MySql操作类

最近写了一个简单的Mysql操作类,拿出来和大家分享一下,还请各位高手指正一下析构函数的用法:
<?php
/*
* Created on 2010-5-25
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*
* class mysql
* made by S71ENCE
*/
class mysql
{
    private $host;//主机名
    private $name;//用户名
    private $pwd;//密码
    private $dataBase;//数据库名
    private $coding;//编码
//初始化
    function __construct($host,$name,$pwd,$dataBase,$coding)
    {
        $this->host=$host;
        $this->name=$name;
        $this->pwd=$pwd;
        $this->dataBase=$dataBase;
       & ......

mysql得到查询结果的同时统计查询结果的数目

做一些数据库查询,不仅希望得到要查询的结果,还希望方便地统计一下查询结果中有多少条记录。我通常的做法是:
$q = "select * from $fromTable where $where limit $start,$pageSize";
$r = mysql_query($q);
$q = "select count(*) from $fromTable where $where";
$cnt = mysql_query($q);

然可以用mysql_num_rows()或者mysql_affected_rows()来在第一次查询后得到记录数目,但是这两个函数返回的都是查询
后得到的结果的数目,是受limit语句的影响的。很多情况下,需要知道这条查询语句在没有limit的情况下结果总数,比如分页查询。
mysql
中本身支持一种更好的方法来达到上面的效果,那就是使用SQL_CALC_FOUND_ROWS和FOUND_ROWS()函数。见:http:
//dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows
应用举例:
mysql> SELECT SQL_CALC_FOUND_ROWS * from tbl_name
-> WHERE id > 100 LIMIT 10;
mysql> SELECT FOUND_ROWS();
......

lighttpd + mysql + php(fast cgi)安装与配置

准备:
lighttpd-1.4.15.tar.gz
php-4.4.2.tar.gz
mysql-5.0.20a.tar.gz
开始:
1 编译安装lighttpd
 # tar zxvf lighttpd-1.4.15.tar.gz
 # cd lighttpd-1.4.15
 #  ls
 # ./configure --prefix=/usr/local/lighttpd    //此部无法编译时提示安装prce-devel
 #  make
 #  make install
 创建网站根目录
 # mkdir /usr/local/lighttpd/htdocs
 创建配置文件放置目录
 #mkdir /usr/local/lighttpd/etc
创建日志目录
#mkdir /usr/local/lighttpd/logs
将配置文件拷贝到/usr/local/lighttpd/etc
#cp doc/lighttpd.conf /usr/local/lighttpd/etc
 
 启动lighttpd
 #/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
我在安装的时候在error日志出现 opening errorlog '/var/log/lighttpd/access.log
在/var/log下建立lighttpd目录就可以了
 
2 安装 MYSQL
#  tar zxvf mysql-5.0.20a.tar.gz
#  cd mysql-5.0.20a
#  ./configure --prefix=/usr/local/mysql
#  make;make install
# grou ......

lighttpd + mysql + php(fast cgi)安装与配置

准备:
lighttpd-1.4.15.tar.gz
php-4.4.2.tar.gz
mysql-5.0.20a.tar.gz
开始:
1 编译安装lighttpd
 # tar zxvf lighttpd-1.4.15.tar.gz
 # cd lighttpd-1.4.15
 #  ls
 # ./configure --prefix=/usr/local/lighttpd    //此部无法编译时提示安装prce-devel
 #  make
 #  make install
 创建网站根目录
 # mkdir /usr/local/lighttpd/htdocs
 创建配置文件放置目录
 #mkdir /usr/local/lighttpd/etc
创建日志目录
#mkdir /usr/local/lighttpd/logs
将配置文件拷贝到/usr/local/lighttpd/etc
#cp doc/lighttpd.conf /usr/local/lighttpd/etc
 
 启动lighttpd
 #/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/etc/lighttpd.conf
我在安装的时候在error日志出现 opening errorlog '/var/log/lighttpd/access.log
在/var/log下建立lighttpd目录就可以了
 
2 安装 MYSQL
#  tar zxvf mysql-5.0.20a.tar.gz
#  cd mysql-5.0.20a
#  ./configure --prefix=/usr/local/mysql
#  make;make install
# grou ......

JAVA调用MYSQL存储过程

JAVA调用MYSQL存储过程
工程视图:
代码清单:
myconn.java
package org.apache.sh_mysql.test;
import java.sql.*;
public class MyConn {

private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=GBK";
private static final String USER = "root";
private static final String PASSWORD ="root";
static {
try {
Class.forName(DRIVER);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取连接
*
* @return
* @throws Exception
*/
public Connection getConnection() throws Exception {
return DriverManager.getConnection(URL, USER, PASSWORD);
}
/**
* 释放资源
*
* @param rs
* @param statement
* @param conn
*/
public void close(ResultSet rs, CallableStatement stmt, Connection conn) {
try{
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn. ......

JAVA调用MYSQL存储过程

JAVA调用MYSQL存储过程
工程视图:
代码清单:
myconn.java
package org.apache.sh_mysql.test;
import java.sql.*;
public class MyConn {

private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=GBK";
private static final String USER = "root";
private static final String PASSWORD ="root";
static {
try {
Class.forName(DRIVER);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取连接
*
* @return
* @throws Exception
*/
public Connection getConnection() throws Exception {
return DriverManager.getConnection(URL, USER, PASSWORD);
}
/**
* 释放资源
*
* @param rs
* @param statement
* @param conn
*/
public void close(ResultSet rs, CallableStatement stmt, Connection conn) {
try{
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn. ......
总记录数:2220; 总页数:370; 每页6 条; 首页 上一页 [2] [3] [4] [5] 6 [7] [8] [9] [10] [11]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号