JavaÁ¬½ÓmysqlÊý¾Ý¿â
Ê×ÏÈ£¬´ò¿ªMySQL Query Browser£¬ÔÚµ±Ç°TestÊý¾Ý¿âÏ£¬Ð½¨Ò»¸östudent±í£¬ÓÐÈçÏÂÊôÐÔ£º
create table student (name varchar(10),id int(2),sex varchar(10));
³ÌÐò¼ûÏ£º
package com.JDBC;
import java.sql.*;
public class JDBCTest {
public static void main(String[] args) {String driver = "com.mysql.jdbc.Driver"; // Çý¶¯³ÌÐòÃû
String url = "jdbc:mysql://localhost/test"; // URLÖ¸ÏòÒª·ÃÎʵÄÊý¾Ý¿âÃûscutcs
String user = "root"; // MySQLÅäÖÃʱµÄÓû§Ãû
String password = "123456"; // MySQLÅäÖÃʱµÄÃÜÂë
try {
Class.forName(driver); // ¼ÓÔØÇý¶¯³ÌÐò
Connection conn = DriverManager.getConnection(url, user, password); // Á¬ÐøÊý¾Ý¿â
if (!conn.isClosed())
System.out.println("Succeeded connecting to the Database!"); // ÑéÖ¤ÊÇ·ñÁ¬½Ó³É¹¦
Statement statement = conn.createStatement(); // statementÓÃÀ´Ö´ÐÐSQLÓï¾ä
String sql = "select * from student"; // ÒªÖ´ÐеÄSQLÓï¾ä
ResultSet rs = statement.executeQuery(sql); // ½á¹û¼¯
System.out.println("-----------------------------------------");
System.out.println("Ö´Ðнá¹ûÈçÏÂËùʾ:");
System.out.println("-----------------------------------------");
System.out.println(" ѧºÅ" + "\t\t" + " ÐÕÃû" + "\t\t" + "ÐÔ±ð");
System.out.println("-----------------------------------------");
String name = null;
while (rs.next()) {
name = rs.getString("name"); // Ñ¡ÔñnoÕâÁÐÊý¾Ý
System.out.println(rs.getString("id") + "\t\t" + name + "\t\t"
+ rs.getString("sex")); // Êä³ö½á¹û
}
rs.close();
conn.close();
} catch (ClassNotFoundException e) {
System.out.println("Sorry,can`t find the Driver!");
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Ïà¹ØÎĵµ£º
Íü¼ÇMySQL ROOTÃÜÂëÊÇÔÚMySQLʹÓÃÖкܳ£¼ûµÄÎÊÌ⣬¿ÉÊÇÓкܶàÅóÓѲ¢²»»áÖØÖÃROOTÃÜÂ룬Äǽпడ£¬ÎÒÓÐÉîÓид¥£¬ÌØÐ´´ËÎÄÕÂÓë´ó¼Ò½»Á÷£º
1¡¢±à¼MySQL(ºÍPHP´îÅäÖ®×î¼Ñ×éºÏ)ÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini
//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf ......
ÍíÉÏÓÐÅóÓÑÎÊÆð£¬¼òµ¥µÄдÁËÒ»¸ö¡£
DELIMITER $$
CREATE
FUNCTION `t_girl`
.
`func_rand_string`
(
f_num tinyint
unsigned
,
f_type tinyint
unsigned
)
RETURNS varchar
(
32)
BEGIN
......
#!/usr/bin/perl
use Mysql;
print "Content-type:
text/html \n\n";
# MySQL
ÅäÖñäÁ¿
$host = "localhost";
$database
= "testdb";
$tablename = "testtable";
$user = "username";
$pw =
"password";
# PERL MYSQL CONNECT()
$connect = ......
ÓÉÓÚ°²×°MySQLµÄʱºò£¬ÊèºöûÓÐÑ¡Ôñµ×²ã±àÂ뷽ʽ£¬²ÉÓÃĬÈϵÄASCIIµÄ±àÂë¸ñʽ£¬ÓÚÊǽӶþÁ¬ÈýµÄÖÐÎÄת»»ÎÊÌâËæÖ®¶øÀ´£¬¾ÍÏëÐ¶ÔØÁËÖØÐ°²×°MYSQL£¬ÕâÒ»Ð¶ÔØµ¹ÊdzöÁËÎÊÌ⣬µ¼Ö°²×°µÄʱºò°²×°²»ÉÏ£¬ÔÚÍøÉÏÕÒÁËÒ»¸ö¶àСʱҲû½â¾ö¡£
ÖØ×°ÏµÍ³ÓÀÔ¶ÊǸöºÃ°ì·¨£¬µ«ÓÐËϲ»¶Õâô×öѽ:(
ºóÀ´ÎÞÒâ·¢ÏÖÊÇÐ¶ÔØµÄʱºòûÓÐÐ¶ÔØÍêÈ«µ¼Ö£ ......
¿ÉÒÔ£¬µ«ÊÇÍêÈ«»Ö¸´ËùÓÐµÄ±í²»Ò»¶¨¿ÉÒÔ
¹¤¾ß: innodb-recovery
Official Website: http://code.google.com/p/innodb-tools/
This set of tools could be used to check InnoDB
tablespaces and to recover data from damaged tablespaces or from
dropped/truncated InnoDB tables.
Õâ¸ö¹¤¾ßÓÃÀ´¼ì²éInnoDB¿Õ¼ä±íºÍ» ......