MySQL 5.1 é«éã¤ã³ã¹ãã¼ã«æé Windowsç¨
Windowsã§MySQL 5.1ãã¡ãã£ã¨è©¦ãã¦ã¿ããã¨ããæ¹åãã®ã¤ã³ã¹ãã¼ã«æé æ¸ã§ããWebã§æ¤ç´¢ããã¨MySQLã®ã¤ã³ã¹ãã¼ã«æé æ¸ã¯ããããè¦ã¤ããã®ã§ãããä»åãç´¹ä»ããæé ã«ã¯ãããªç¹é·ãããã¾ãã
- ã¤ã³ã¹ãã¼ã«æç¹ã§MySQLã®ç¥èãä¸è¦
- èµ·åã»åæ¢ãç°¡å
- ã¬ã¸ã¹ããªãæ±ããªã
- ãµã¼ãã¹ãä½ããªã
- ã¢ã³ã¤ã³ã¹ãã¼ã«ãç°¡å
- ãµã³ãã«ãã¼ã¿ãã¼ã¹ä»ã
MySQL ZIPçããã¦ã³ãã¼ããã
MySQLã®ãã¦ã³ãã¼ããµã¤ãã§ã¯ãWindowsç¨ã®ãã¤ããªã¨ãã¦ä»¥ä¸ã®3種é¡ãç¨æããã¦ãã¾ãã
æ®éã¯MSIçãå©ç¨ããã®ã§ãããã¡ãã£ã¨è©¦ãã¦ã¿ããã ãã¨ããå ´åã¯ZIPç(Without installer (unzip in C:\))ã®æ¹ã便å©ã§ããä»åã¯ZIPçããã¦ã³ãã¼ããã¾ãã
ã¢ã¼ã«ã¤ããC:ãã©ã¤ãç´ä¸ã«å±éãã
ãã¦ã³ãã¼ãããmysql-noinstall-5.1.37-win32.zipãC:ãã©ã¤ãç´ä¸ã«å±éãã¾ããZIPçã¯ããã«å±éããããã¨ãåæã«ãã¦å®è¡ãã¡ã¤ã«ããã«ãããã¦ãããããå ´æãååãå¤ãã¦ã¯ããã¾ããã
ãã©ã¡ã¼ã¿ãã¡ã¤ã«my.iniãä½æãã
C:\mysql-5.1.37-win32 ãã©ã«ãã«ãã©ã¡ã¼ã¿ãã¡ã¤ã«my.iniãä½æããä¸èº«ãè¨è¿°ãã¾ããå ã MySQLã«ã¯my-large.iniãmy-medium.iniãªã©ã®ãµã³ãã«ãã¡ã¤ã«ãä»å±ãã¦ããã®ã§ããããããã®ãµã³ãã«ãã¡ã¤ã«ã¯ãã®ã¾ã¾ä½¿ãã¨æ¥æ¬èªã100%æååããããªã©ãããã¤ãåé¡ãããã¾ããã¾ãã¯ä»¥ä¸ã®ããã¹ãããã®ã¾ã¾ã³ãã¼ãã¦ã使ããã ããã
[mysqld] ## character set character_set_server = utf8 collation_server = utf8_general_ci ## storage engine default_storage_engine = InnoDB transaction_isolation = READ-COMMITTED innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 1 innodb_buffer_pool_size = 64M innodb_log_buffer_size = 8M innodb_log_file_size = 128M ## binary log #log_bin = mysql-bin #binlog_format = MIXED #sync_binlog = 1 #binlog_cache_size = 1M ## slow query log slow_query_log = 1 long_query_time = 1.0 ## query cache query_cache_type = 1 query_cache_size = 16M ## etc. max_connections = 128 thread_cache_size = 8 table_open_cache = 512 max_allowed_packet = 16M sort_buffer_size = 4M read_buffer_size = 1M console = 1 [mysql] default_character_set = cp932
ãã®ãã©ã¡ã¼ã¿ãã¡ã¤ã«ã¯ããã©ã³ã¶ã¯ã·ã§ã³ãè¡ã¬ãã«ããã¯ããµãã¼ãããInnoDBã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ã使ç¨ããè¨å®ã«ãªã£ã¦ãã¾ãããã®ããkey_buffer_sizeãªã©MyISAMã¹ãã¬ã¼ã¸ã¨ã³ã¸ã³ã«é¢ããè¨å®ã¯è¨è¿°ããã¦ãã¾ããã
MySQLãµã¼ããèµ·åãã
MySQLãµã¼ããèµ·åãã¾ããZIPçã®å ´åãããã¯binãã©ã«ãã«ããmysqld.exeãããã«ã¯ãªãã¯ããã ãã§ãã
ããã¨ãã®ããã«ã³ãã³ãããã³ããã¦ã£ã³ãã¦ãç¾ããready for connections.ã¾ã§é²ãã°èµ·åå®äºã¨ãªãã¾ããèµ·åå®äºå¾ããã®ã¦ã£ã³ãã¦ã¯ãã®ã¾ã¾ã«ãã¦ããã¦ãã ããã
ååèµ·åæã¯ä»¥ä¸ã®ããã«Windowsãã¡ã¤ã¢ã¦ã©ã¼ã«ã®è¦åã表示ããã¾ããå¿
ãããããã¯ã解é¤ããããé¸æãã¦ãã ããã
ã³ãã³ãããã³ããããmysql.exeãèµ·åããåæè¨å®ã¹ã¯ãªãããå®è¡ãã
åæè¨å®ã®ããã«ãã³ãã³ãããã³ããããmysql.exeãèµ·åãã¦MySQLãµã¼ãã«ãã°ã¤ã³ãã¾ãããã®ã¨ãã¹ã¯ãªã¼ã³ã·ã§ããã®ããã«-u rootãªãã·ã§ã³ãã¤ãã¦ã管çè
ã¨ãã¦ãã°ã¤ã³ãã¦ãã ããã
管çè
ã¨ãã¦ãã°ã¤ã³ãããã次ã«ç¤ºãã¹ã¯ãªãããã³ãã¼ï¼ãã¼ã¹ããã¦å®è¡ãã¦ãã ããããã®ã¹ã¯ãªããã«ãã£ã¦ä»¥ä¸ã®è¨å®ãè¡ããã¾ãã
- ã²ã¹ãã¦ã¼ã¶ã®åé¤
- testãã¼ã¿ãã¼ã¹ã®åé¤
- scottãã¼ã¿ãã¼ã¹ã®ä½æ
- scottã¦ã¼ã¶ã®ä½æ
- ãµã³ãã«ãã¼ãã«ã®ä½æã¨ãã¼ã¿çæ
drop user ''@localhost; drop database test; create database scott; grant all privileges on scott.* to scott@'%' identified by 'tiger'; use scott create table dept (deptno decimal(2) primary key, dname varchar(14) , loc varchar(13)); create table emp (empno decimal(4) primary key, ename varchar(10), job varchar(9), mgr decimal(4), hiredate date, sal decimal(7,2), comm decimal(7,2), deptno decimal(2), foreign key (deptno) references dept (deptno)); create table bonus (ename varchar(10), job varchar(9), sal decimal, comm decimal); create table salgrade (grade decimal, losal decimal, hisal decimal); begin; insert into dept values (10,'accounting','new york'); insert into dept values (20,'research','dallas'); insert into dept values (30,'sales','chicago'); insert into dept values (40,'operations','boston'); insert into emp values (7369,'smith','clerk',7902,str_to_date('17-12-1980','%d-%m-%Y'),800,null,20); insert into emp values (7499,'allen','salesman',7698,str_to_date('20-2-1981','%d-%m-%Y'),1600,300,30); insert into emp values (7521,'ward','salesman',7698,str_to_date('22-2-1981','%d-%m-%Y'),1250,500,30); insert into emp values (7566,'jones','manager',7839,str_to_date('2-4-1981','%d-%m-%Y'),2975,null,20); insert into emp values (7654,'martin','salesman',7698,str_to_date('28-9-1981','%d-%m-%Y'),1250,1400,30); insert into emp values (7698,'blake','manager',7839,str_to_date('1-5-1981','%d-%m-%Y'),2850,null,30); insert into emp values (7782,'clark','manager',7839,str_to_date('9-6-1981','%d-%m-%Y'),2450,null,10); insert into emp values (7788,'scott','analyst',7566,date_add(str_to_date('13-jul-87','%d-%b-%y'), interval -85 day),3000,null,20); insert into emp values (7839,'king','president',null,str_to_date('17-11-1981','%d-%m-%Y'),5000,null,10); insert into emp values (7844,'turner','salesman',7698,str_to_date('8-9-1981','%d-%m-%Y'),1500,0,30); insert into emp values (7876,'adams','clerk',7788,date_add(str_to_date('13-jul-87', '%d-%b-%y'), interval -51 day),1100,null,20); insert into emp values (7900,'james','clerk',7698,str_to_date('3-12-1981','%d-%m-%Y'),950,null,30); insert into emp values (7902,'ford','analyst',7566,str_to_date('3-12-1981','%d-%m-%Y'),3000,null,20); insert into emp values (7934,'miller','clerk',7782,str_to_date('23-1-1982','%d-%m-%Y'),1300,null,10); insert into salgrade values (1,700,1200); insert into salgrade values (2,1201,1400); insert into salgrade values (3,1401,2000); insert into salgrade values (4,2001,3000); insert into salgrade values (5,3001,9999); commit;
ã¤ã³ã¹ãã¼ã«å®äº
以ä¸ã§ã¤ã³ã¹ãã¼ã«ã¯å®äºã§ãããã¨ã¯ã好ããªã¯ã©ã¤ã¢ã³ããããã¼ã¿ãã¼ã¹ããå©ç¨ãã ãããMySQLãµã¼ãã¸ã¯ä»¥ä¸ã®è¨å®ã§æ¥ç¶ãããã¨ãã§ãã¾ãã
- ãã¹ãåï¼PCã®IPã¢ãã¬ã¹
- ãã¼ãçªå·ï¼3306
- ã¦ã¼ã¶åï¼scott
- ãã¹ã¯ã¼ãï¼tiger
- æ¥ç¶å ãã¼ã¿ãã¼ã¹ï¼scott
mysql.exeã§ã®æ¥ç¶ä¾ã§ãã
MySQLãµã¼ãã®åæ¢
MySQLãµã¼ããåæ¢ããã«ã¯ãmysqld.exeãèµ·åããã¦ã£ã³ãã¦ã§Ctrl-Cãå
¥åãã¾ãã
ãã©ã¡ã¼ã¿ãã¡ã¤ã«my.iniã§console = 1ã¨è¨å®ãã¦ãããã¨ã§ããã®ããã«mysqld.exeãCtrl-Cãåãä»ããããã«ãªãã¾ããæ¬æ¥MySQLãµã¼ãã®åæ¢ã«ã¯mysqladminã³ãã³ãã使ãã®ã§ãããã¡ãã£ã¨è©¦ãã ããªããã¡ãã®æ¹ãç°¡åã§ããã
ãã ããã¦ã£ã³ãã¦ã®Ããã¿ã³ã§éããã¨ç°å¸¸çµäºã«ãªã£ã¦ãã¾ãã®ã§æ³¨æãå¿
è¦ã§ããCtrl-Cãªãæ£å¸¸çµäºã§ãã
ãã¼ã¿ã®ããã¯ã¢ãã
MySQLãµã¼ããåæ¢ããç¶æ ã§ãdataãã©ã«ããã³ãã¼ãã¦ãã ããã
ã¢ã³ã¤ã³ã¹ãã¼ã«
MySQLãµã¼ããåæ¢ããç¶æ
ã§ãã¤ã³ã¹ãã¼ã«ãããã©ã«ããåé¤ãã¦ãã ããã
ã¬ã¸ã¹ããªã«ã´ããæ®ãããããã«æ¶ããã®ã§ãç°å¢æ§ç¯ã«å¤±æãã¦ãæåãã確å®ã«ããç´ããã¨ãã§ãã¾ããããããã®æé ã®æ大ã®å©ç¹ã§ãã
ã¾ã¨ã
- MySQLã®ZIPçã使ã
- é©åãªmy.iniãç¨æãã
- é©åãªåæè¨å®ã¹ã¯ãªãããç¨æãã¦å®è¡ãã
æ£ç´MSIçã¯ä½¿ãã¥ããã¨æãã¾ããç§ã¯Windowsã§ä½æ¥ããã¨ãã¯ãã¤ãZIPçã使ã£ã¦ãã¾ãã