JDBC ¼òµ¥µÄMysqlÁ¬½Ó
/*ÑÝʾһ¸öJDBC³ÌÐò£¬´ÓMysqlµÄLMDÊý¾Ý¿âÖжÁ³ö±íadminµÄÒ»¸öÐÅÏ¢*/
import java.sql.*;
public class TestMysqlConnection {
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager
.getConnection("jdbc:mysql://localhost/LMD?user=root&password=root");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from admin");
while (rs.next()) {
System.out.println(rs.getString("Name"));
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
} finally {
&nb
Ïà¹ØÎĵµ£º
Ò»¡¢MySQL°²×°£º
Ìí¼ÓϵͳÓû§£º
groupadd mysql (/usr/sbin/groupadd)
useradd -g mysql mysql
°²×°²½Ö裺
tar zxfv mysql-*.tar.gz(mysql-5.0.51a)
./configure --prefix=/usr/local/mysql
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
bin/mysql_install_db --user ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
ÔÚÉÏÒ»½ÚµÄĩβÎÒÃÇÒѾ¿´µ½£¬ÏÖÔÚ¿ÉÓõÄÊý¾Ý¿âÇý¶¯Ö»ÓÐ3ÖÖ£¬ÄÇôÔõÑùʹÓÃÆäËûµÄÊý¾Ý¿âÄØ£¿ÔÚQtÖУ¬ÎÒÃÇÐèÒª×Ô¼º±àÒëÆäËûÊý¾Ý¿âÇý¶¯µÄ´úÂ룬ÈÃËüÃÇÒÔ²å¼þµÄÐÎʽÀ´Ê¹Óá£ÏÂÃæÎÒÃǾÍÒÔÏÖÔڱȽÏÁ÷ÐеÄMySQLÊý¾Ý¿âΪÀý£¬ËµÃ÷Ò»ÏÂÔõÑùÔÚQt CreatorÖÐÌí¼ÓÊý¾Ý¿âÇý¶¯²å¼þ ......
Link from : http://www.5ilinux.com/blog/archives/000091.html
1.Ê×ÏÈÎÒÃǽ¨Á¢ÏàÓ¦µÄÓû§ºÍÓû§×é
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
2.²Ù×÷Êý¾Ý¿â
mysql mysql -uroot -ppassword
create database ftpdb
grant select, upd ......
¹«Ë¾µÄ·þÎñÆ÷ÊÇCentOS 5.4(Final)°æµÄ£¬½ñÌìÔÚÉÏÃæ°²×°ÁËÒ»»Ømysql5.5£¬¼Ç¼ÈçÏ£º
1¡¢´Óhttp://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.2-m2.tar.gz ÏÂÔØÔ´Âë°²×°°üµ½/usr/local/src
2¡¢tar zxvf mysql-5.5.2-m2.tar.gz ½âѹµ½/usr/local/src/mysql-5.5.2-m2ÏÂ
cd mysql-5.5.2-m2/
&n ......
Ò»Ö±ÒÔΪmysqlËæ»ú²éѯ¼¸ÌõÊý¾Ý£¬¾ÍÓÃ
SELECT
*
from
`
table
`
ORDER
BY
RAND
() LIMIT
5
¾Í¿ÉÒÔÁË¡£
µ«ÊÇÕæÕý²âÊÔһϲŷ¢ÏÖÕâÑùЧÂʷdz£µÍ¡£Ò»¸ö15ÍòÓàÌõµÄ¿â£¬²éѯ5ÌõÊý¾Ý£¬¾ÓȻҪ8ÃëÒÔÉÏ
²é¿´¹Ù·½ÊֲᣬҲ˵rand()·ÅÔÚORDER BY ×Ó¾äÖлᱻִÐж ......