MySQLѧϰ±Ê¼Ç
Ò»¡¢MySQL»ù±¾ÃüÁºÏ£º
1¡¢ create database mydata£»//´´½¨Êý¾Ý¿â
2¡¢ use mydata; //ÔÚmydataÕâ¸öÊý¾Ý¿âϹ¤×÷
3¡¢ create table dept //ÔÚmydataÊý¾Ý¿âÏ´´½¨±ídept
(
deptno int primary key,
dname varchar(14),
loc varchar(13)
);
create table emp //ÔÚmydataÊý¾Ý¿âÏ´´½¨±íemp
(
empno int primary key,
ename varchar(10),
job varchar(10),
mar int,
hiredate datetime,
sal double,
comm double,
deptno int,
foreign key (deptno) references dept(deptno)
);
4¡¢ show databases£»//ÏÔʾÊý¾Ý¿â
5¡¢ show tables£»//ÏÔʾ±í
6¡¢ desc dept£»//ÏÔʾdept±íµÄ½á¹¹
7¡¢ insert into dept values£¨10, ‘A’, ‘A’£©£»//Ïòdept±íÖÐÌí¼Ó¼Ç¼
insert into dept values£¨20, ‘B’, ‘B’£©£»
insert into dept values£¨30, ‘C’, ‘C’£©£»
commit£» //Ìá½»
8¡¢ select * from dept£»//²éѯ¼Ç¼
select * from dept order by deptno desc limit 3,2£»//ÏÔʾ¼Ç¼
¶þ¡¢MySQLµÄ×Ô¶¯µÝÔö£º
create table article //´´½¨×Ô¶¯µÝÔö±í
(
Id int primary key auto_increment,
Title varchar(255)
);
Insert into article values(null,’a’);
Insert into article values(null,’b’);
Insert into article(title) values(‘c’);
Èý¡¢MySQLµÄÈÕÆÚʱ¼ä£º
1¡¢ select now£¨£©£»//ÏÔʾµ±Ç°Ê±¼ä
2¡¢ select date_format(now( ),’%y-%m-%d %H£º%i£º%s’)£»//ÏÔʾָ¶¨¸ñʽµÄʱ¼ä
ËÄ¡¢MySQL_jdbcÁ¬½Ó£º
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");
&nb
Ïà¹ØÎĵµ£º
±àÒëÇ°ÐèÒª°²×°µÄ¿â£º
g++
libmysqlclient15-dev
libglade2-dev
libglib2.0-dev
libgtkmm-2.4-dev
libpcre3-dev
libxml2-dev
È»ºóÖ´ÐÐ
cd mysql-gui-common
./configure
make
sudo make install
cd ../mysql-administrator
./configure
make
sudo make install
°²×°MySQL Administrator
°²×°Íê³Éºómysql- ......
ÔÚ
oracle
ÖУ¬
sequence
Ìṩ¶à±í¶à×ֶοɹ²ÓÃÒ»¸ö²»Öظ´Öµ¡£
Mysql
ÖдæÔÚ×ÔÔöÁУ¬»ù±¾¿ÉÒÔÂú×ã
PK
µÄÒªÇó¡£µ«×ÔÔöÁдæÔÚÏÞÖÆ£º
a.
Ö»ÄÜÓÃÓÚ±íÖеÄÒ»¸ö×ֶΣ¬Ò»ÕŲ»ÄÜͬʱ´æÔÚÁ½¸öÒÔÉϵÄ×ÔÔöÁÐ
;
b.
×ÔÔöÁбØÐë±»¶¨ÒåΪ
key
£¨
PK
»ò
FK
£©
;
c.
×ÔÔöÁв»Äܱ»¶à¸ö±í¹²ÓÃ
;
d.
µ±
insert
Óï¾ä² ......
Java´úÂë
mysql> select version(),current_date;
²éѯmysqlµÄ°æ±¾ºÅ ºÍ ÈÕÆÚ
mysql> select version();
²éѯmysqlµÄ°æ±¾ºÅ
select now();
²éѯµ±Ç°ÈÕÆÚºÍ׼ȷµÄʱ¼ä
Java ......
ÏÂÔصØÖ·£ºhttp://download.csdn.net/down/434743/yuzhongqing2005
Navicat 8 for MySQLµÄ×¢²áÂ룺
PremiumSoft Navicat for MySQL Enterprise Edition v8.XX
ÐÕÃû(Name)£º3ddown.com
×éÖ¯(Organization)£º3ddown.com
×¢²áÂë(Serial)£ºNAVJ-W56S-3YUU-MVHV ......
×÷ÕߣºÀÏÍõ
MySQL5.X¶¼ÒѾ·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵģ¬Æäʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃ棬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓ ......