Linux Memo/MySQL
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
]
³«»Ï¹Ô:
*MySQL [#m93eeef6]
RIGHT:¹¹¿·Æü &lastmod();
**MySQL¤Î¥¤¥ó¥¹¥È¡¼¥ë [#r0532473]
MySQL¤Î¥½¡¼¥¹¤ò[[¤³¤³:http://dev.mysql.com/downloads/]]¤Î...
$ su
# /usr/sbin/useradd mysql
home¥Ç¥£¥ì¥¯¥È¥ê¤ò/usr/local/var¤ËÊѹ¹
$ tar zxvf mysql-4.1.12.tar.gz
$ cd mysql-4.1.12
$ ./configure --with-charset=ujis -with-extra-charsets=a...
--with-mysqld-user=mysql
--with-charset
¥Ç¥Õ¥©¥ë¥È¤Ç»ÈÍѤµ¤ì¤ëʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£EUC¤Ê¤éuji...
--with-extra-charset
¥Ç¥Õ¥©¥ë¥È¤Ç»ØÄꤵ¤ì¤¿Ê¸»ú¥³¡¼¥É°Ê³°¤ò¥µ¥Ý¡¼¥È¤·¤¿¤¤¾ì¹ç...
"--with-extra-charset=ujis,sjis,..."¤Î¤è¤¦¤Ë¸ÄÊ̤˻ØÄê¤Ç...
¤³¤³¤Ç¤Ï¡Èall¡É¤È¤·¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢
make¤ò¤·Ä¾¤µ¤º¤È¤â¡¢°Û¤Ê¤ëʸ»ú¥³¡¼¥É¤Ç¥µ¡¼¥Ð¤òµ¯Æ°¤¹¤ë¤³...
--with-mysqld-user
MySQL¥Ç¡¼¥â¥ó¤òµ¯Æ°¤¹¤ë¥æ¡¼¥¶¡¼¤Î»ØÄê
$ make
$ su
# make install
# cp support-files/my-medium.cnf /etc/my.cnf <---(1)
(1)¤Ç¥³¥Ô¡¼¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ
|¥Õ¥¡¥¤¥ë̾|»ÈÍÑÍÑÅÓ|
|my-small.cnf|64MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-medium.cnf|128MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-large.cnf|512MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-huge.cnf|1GB¡Á2GB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-innodb-heavy-4G.cnf|4GB¤Î¥á¥â¥ê¤ÈInnoDB¤ÇºîÀ®¤µ¤ì¤¿¥Ç...
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î½é´ü²½ [#y9e7af00]
°Ê²¼¥Ç¡¼¥¿¥Ù¡¼¥¹¥³¥Þ¥ó¥É¤òroot¤Ç¹Ô¤Ã¤Æ¤¤¤ë¤¬¥·¥¹¥Æ¥à´Ø·¸...
# /usr/local/bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-fi...
to the right place for your system
(ά)
he latest information about MySQL is available on the we...
http://www.mysql.com
Support MySQL by buying support/licenses at https://orde...
# /usr/local/var(¥Ç¡¼¥¿¥Ù¡¼¥¹ÊݸÀè)¤Î¥ª¡¼¥Ê¤òÊѹ¹
# chown -R mysql.mysql /usr/local/var
**µ¯Æ° [#xb063eb2]
# /usr/local/bin/mysqld_safe --user=mysql --log &
Æ°ºî³Îǧ
--log¤Ç/usr/local/var/(¥µ¡¼¥Ð̾).log¤Çlogfile¤¬ºîÀ®¤µ¤ì¤ë
°Ê²¼¤Î¥³¥Þ¥ó¥É¤Ç·ë²Ì¤¬°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ì¤ÐOK
# /usr/local/bin/mysqlshow
+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+
Á´¤Æ¤ÎDB¤òɽ¼¨¤¹¤ë¤Ë¤Ï(root¤Î¥Ñ¥¹¥ï¡¼¥ÉÀßÄê¸å¤Ï)
$ /usr/local/bin/mysqlshow -u root -p
Enter password:*****
+-----------+
| Databases |
+-----------+
| moodle |
| mysql |
| test |
| xoops |
+-----------+
***¥Ñ¥é¥á¡¼¥¿¤Î»ØÄê [#i813e443]
¤¿¤È¤¨¤Ð¡¢MySQL¤ÎºÇÂçÀܳ¿ô¤ò¾å¤²¤ë¤Ë¤Ï¡¢mysqld¤Ë¥ª¥×¥·¥ç...
/etc/my.cnf¤Î
[mysqld]
max_connections = 120
¤ËÄɲ乤롣
''log¤Î¼è¤êÊý''
[mysqld]
log=/var/log/mysql.log
¤òÄɲÃ
# touch /var/log/mysql.log
# chown mysql.mysql /var/log/mysql.log
**MySQL¤ÎÄä»ß [#rd1407e2]
$ /usr/local/bin/mysqladmin -u root -p shutdown
**MySQL¤òÆ°¤«¤¹ [#m3fb10c4]
MySQL¤Îroot ¤Î¥Ñ¥¹¥ï¡¼¥ÉÀßÄê
$ /usr/local/bin/mysqladmin -u root password '******' <-...
¾åµ¤Îmysqladmin¤Ç¥Ñ¥¹¥ï¡¼¥É¤òÀßÄꤷ¤¿¤È¤¤Ï°Ê²¼¤Î¥³¥Þ¥ó...
$ /usr/local/bin/mysqladmin -u root -p reload
Enter password:
''root¤Î¥Ñ¥¹¥ï¡¼¥ÉÊѹ¹''
$ mysqladmin -u root -p password '******' <--NewPassword
Enter password: ******* <--OldPassword
¡Ömysqladmin -u root -p reload¡×¤¬É¬Íפ«¤ÏÉÔÌÀ
# mysql -u root -p
Enter password: <--£±(1)¤Î¥Ñ¥¹¥ï¡¼¥É¤òÆþÎÏ
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the bu...
mysql>
mysql> select host,user,password from mysql.user;
+-----------+------+------------------------------------...
| host | user | password ...
+-----------+------+------------------------------------...
| localhost | root | *3*********************************...
| open2_06 | root | ...
| open2_06 | | ...
| localhost | | ...
+-----------+------+------------------------------------...
4 rows in set (0.00 sec)
***root¤Çmysql¤Ë¥í¥°¥¤¥ó [#fcdf759e]
# mysql -u root mysql
¤â¤¦¤È¤Ä¤Îroot¤Î¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê(root@open2_06)
SET PASSWORD ¹½Ê¸¤Ç¥Ñ¥¹¥ï¡¼¥É¤ÎÀßÄê¡£
mysql> SET PASSWORD FOR 'root'@'open2_06' = PASSWORD('**...
Query OK, 0 rows affected (0.00 sec)
¤¹¤Ù¤Æ¤Î¤³¤È¤¬½ÐÍè¤ëspadmin¤È¤¤¤¦¥æ¡¼¥¶¤òÅÐÏ¿(¥í¡¼¥«¥ë¤Î¤ß)
mysql> GRANT ALL PRIVILEGES ON *.* TO spadmin@localhost ...
Query OK, 0 rows affected (0.01 sec)
¥ê¥â¡¼¥È¤«¤é¤â¤¹¤Ù¤Æ¤Î¤³¤È¤¬½ÐÍè¤ë¤Ë¤Ï
mysql> GRANT ALL PRIVILEGES ON *.* TO spadmin@"%" IDENTI...
¤ÎÄɲä¬É¬Í×(¥ê¥â¡¼¥È¤«¤é¤Îµö²Ä¤òÍ¿¤¨¤ë¤Ë¤Ï¥í¡¼¥«¥ë¤âɬÍ×)
GRAN¼Â¹Ô¸å¤Ï
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
¤òɬ¤º¼Â¹Ô
Ãí¡Ë¥æ¡¼¥¶Ì¾¤Ïmysql -u¤Ç»ØÄꤷ¤Ê¤¤¸Â¤êlogin¥æ¡¼¥¶Ì¾¤Ë¤Ê¤ë
***¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹ [#t3f987d7]
mysql> SET PASSWORD FOR spadmin@localhost = PASSWORD('**...
Query OK, 0 rows affected (0.00 sec)
***¥æ¡¼¥¶ºï½ü [#c26fa3a9]
¥æ¡¼¥¶ºï½ü¤Ï¸¢¸Â¤òÇíÃ¥¸åºï½ü¤¹¤ë¡£¤È¤ê¤¢¤¨¤º¥í¥°¥¤¥ó¤¹¤ë
$ /usr/local/bin/mysql -u root -p mytest
''¸¢¸Â¤òÇíÃ¥(revoke)''
revoke ¸¢¸Â on ¥Ç¡¼¥¿¥Ù¡¼¥¹Ì¾.¥Æ¡¼¥Ö¥ë̾ from ¥æ¡¼¥¶Ì¾@¥Û...
mysql> revoke all on mytest.* from okada@'192.168.1.1';
Query OK, 0 rows affected (0.00 sec)
''ÅÐÏ¿¥æ¡¼¥¶¤Îºï½ü''
mysql> delete from mysql.user where host='192.168.1.1' a...
or
(mysql> DELETE FROM mysql.user WHERE user='okada';)
mysql> flush privileges;
***¥æ¡¼¥¶¤Î¸¢¸Â¤Î³Îǧ [#s4fd0cff]
¡ÖGRANT USAGE ON *.* TO 'okada'@'localhost'¡×¤Î¡Ê£±¡Ë¤Î¹Ô...
$ /usr/local/bin/mysql -u root -p
mysql> SHOW GRANTS FOR okada@localhost;
+-------------------------------------------------------...
| Grants for okada@localhost ...
+-------------------------------------------------------...
| GRANT USAGE ON *.* TO 'okada'@'localhost' IDENTIFIED B...
| GRANT ALL PRIVILEGES ON `xoops`.* TO 'okada'@'localhos...
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, IN...
DB̾(eccubu_db)¤â³Îǧ¤Ç¤¤ë
+-------------------------------------------------------...
3 rows in set (0.00 sec)
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ® [#t7e8056b]
# /usr/local/bin/mysqladmin -u root -p create mytest
ʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Æ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®
mysql> CREATE DATABASE hoge CHARACTER SET SJIS;
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î°ìÍ÷
# /usr/local/bin/mysqlshow -u root -p
Enter password:
+-----------+
| Databases |
+-----------+
| mysql |
| mytest |
| test |
+-----------+
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îºï½ü
# /usr/local/bin/mysqladmin -u root -p drop (DB̾)
or
mysql> drop database (DB̾);
¤³¤Î¥³¥Þ¥ó¥É¤À¤±¤Ç¤Ïmysql.db¥Æ¡¼¥Ö¥ë¤Ë»Ä¤Ã¤Æ¤¤¤ë¤è¤¦¤Ê¤Î...
mysql> delete from mysql.db where Db='(DB̾)';
¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
t_test.create
create table t_test (
ID ¡¡¡¡int8,
data2 int8,
data3 varchar(64) character set utf8
);
# /usr/local/bin/mysql -u root -p mytest < t_test.create
Enter password:
mysql> show fields from t_test;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| ID | bigint(20) | YES | | NULL | |
| data2 | bigint(20) | YES | | NULL | |
| data3 | varchar(64) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
¥Æ¡¼¥Ö¥ë°ìÍ÷
# /usr/local/bin/mysql -u root -p mytest
mysql> SHOW TABLES;
+------------------+
| Tables_in_mytest |
+------------------+
| t_test |
+------------------+
1 row in set (0.00 sec)
¥Ç¡¼¥¿¤ÎÆþÎÏÅù(postgresql¤ÈƱ¤¸)
mysql> insert into t_test values(1, 1001, 'JE2ISM');
Query OK, 1 row affected (0.00 sec)
mysql> select * from t_test;
+------+-------+--------+
| ID | data2 | data3 |
+------+-------+--------+
| 1 | 1001 | JE2ISM |
| 2 | 1002 | JF2LYU |
+------+-------+--------+
2 rows in set (0.00 sec)
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¥Ã¥¯¥¢¥Ã¥×¡¿¥ê¥¹¥È¥¢ [#kbb23c61]
***¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¥Ã¥¯¥¢¥Ã¥× [#q7130506]
# /usr/local/bin/mysqldump -u root -p --default-characte...
EUC¤Î¤È¤¤Ï--default-character-set=ujis¤Ë,UTF8¤Ï utf8¤Ë...
***¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥ê¥¹¥È¥¢ [#f22863ed]
Àè¤ËɬÍפʤéGRANT¤Ç¥æ¡¼¥¶Åù¤Ëµö²Ä¤òÍ¿¤¨¤ë¡£
# /usr/local/bin/mysqladmin -u root -p create mytest
# /usr/local/bin/mysql -u root -p mytest < mytest.out
¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô
# /usr/local/bin/mysqladmin flush-privileges
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îºï½ü [#nd1143e0]
# /usr/local/bin/mysqladmin -u root -p drop mytest
Enter password:
Dropping the database is potentially a very bad thing to...
Any data stored in the database will be destroyed.
Do you really want to drop the 'mytest' database [y/N] y
Database "mytest" dropped
***¥Í¥Ã¥È¥ï¡¼¥¯¾å¤«¤éÀܳµö²Ä¤¹¤ë¤Ë¤Ï [#c39a52ac]
$ /usr/local/bin/mysql -u root -p
¤ÇÀܳ¤·¡¢µö²Ä¤¹¤ë¥æ¡¼¥¶¡¢¥Ñ¥¹¥ï¡¼¥É¡¢¥Í¥Ã¥È¥ï¡¼¥¯(¥Û¥¹...
mysql> GRANT ALL PRIVILEGES ON mytest.* TO okada@'192.16...
mysql> flush privileges;
mysql> select host,user,password from mysql.user;
+----------------------------+------------+-------------...
| host | user | password ...
+----------------------------+------------+-------------...
| localhost | root | *B**********...
| uso5004.mie-chukyo-u.ac.jp | root | ...
| localhost | | ...
| localhost | moodleuser | *B**********...
| 192.168.1.0/255.255.255.0 | okada | *3**********...
+----------------------------+------------+-------------...
6 rows in set (0.00 sec)
¥ê¥â¡¼¥È¤«¤é
°Ê²¼¤Î¥³¥Þ¥ó¥É¤ÇÀܳ
$ /usr/local/bin/mysql -u okada -p mytest -h 192.168.1.1
Enter password:
***MySQL¥µ¡¼¥Ð¡¼¤ÎÁ´ÀßÄê¾ðÊó(ÊÑ¿ô¤ä¥¹¥Æ¡¼¥¿¥¹)¤Îɽ¼¨ [#ae...
mysql> show variables;
mysql> show variables like 'key%';
--------------------------+---------+
| Variable_name | Value |
--------------------------+---------+
| key_buffer_size | 8388600 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit| 100 |
--------------------------+---------+
4 rows in set (0.00 sec)
mysql> SHOW STATUS like 'key%';
------------------------+-------+
| Variable_name | Value |
------------------------+-------+
| Key_blocks_not_flushed| 0 |
| Key_blocks_unused | 28971 |
| Key_blocks_used | 24 |
| Key_read_requests | 231 |
| Key_reads | 24 |
| Key_write_requests | 0 |
| Key_writes | 0 |
------------------------+-------+
7 rows in set (0.00 sec)
*****MySQL¥µ¡¼¥Ð¡¼¤ÎÁ´ÀßÄê¾ðÊó(ÊÑ¿ô)¤ÎÀßÄê [#a27848f1]
/etc/my.cnf¤ËÀßÄꤹ¤ë¤³¤È¤â²Äǽ¤À¤¬¡¢Ä¾ÀÜ¥»¥Ã¥È¤·¤Æ¤â¤è¤¤¡£
mysql> set Global key_buffer_size= 33554432;
Query OK, 0 rows affected (0.01 sec)
SET GLOBAL sort_buffer_size = 10 * 1024 * 1024;
SET SESSION sort_buffer_size = 10 * 1024 * 1024;
¥·¥¹¥Æ¥àÊÑ¿ô¤Ë¤Ï¡¢¥µ¡¼¥Ð¶¦Ä̤ÎÃͤȥ»¥Ã¥·¥ç¥ó(Àܳ)¶¦Ä̤Î...
Á°¼Ô¤òÊѹ¹¤¹¤ë¤È¡¢¤½¤Î¸å³«¤«¤ì¤ëÁ´¤Æ¤Î¥»¥Ã¥·¥ç¥ó¤Ë±Æ¶Á¡¢...
***¥Æ¡¼¥Ö¥ë¤Î¥¨¥¯¥¹¥Ý¡¼¥È/¥¤¥ó¥Ý¡¼¥È [#m1fb8e3c]
''¥¨¥¯¥¹¥Ý¡¼¥È''
mysql> select * from t_test into outfile "/tmp/t_test.cs...
Ãí¡Ëmysql¼Â¹Ô¥æ¡¼¥¶¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¤È½ñ¤¹þ¤ß¸¢¸Â¤¬¤Ê...
''¥¤¥ó¥Ý¡¼¥È''
mysql> load data infile "/home/okada/mysqltest/t_test.cs...
&color(red){ʸ»ú¥³¡¼¥É¤Ë¤Ä¤¤¤Æ};~
LOAD DATA INFILE(¥¤¥ó¥Ý¡¼¥È)¤Ïcharacter_set_databaseÊÑ¿ô...
mysql> show variables like 'char%'; ¤Ç³Îǧ~
character_set_database | ujis <=EUC
-DatabaseºîÀ®»þ¤Ëdefault character set¤Ç»ØÄꤹ¤ë¡£
-LOAD DATA INFILE¤ËÌÀ¼¨Åª¤Ëcharacter set¤ò»ØÄꤹ¤ë.
character set ujis
-character_set_database¤òÊѹ¹¤¹¤ë
mysql> set character_set_database='ujis';
***DB¤ÎÊѹ¹ [#k5d794ac]
root¤Î¾ì¹ç¡¢Â¾¤ÎDB¤ËÊѹ¹¤Ç¤¤ë
mysql> use authdb
Database changed
**´Êñ¤Ê¥Á¥å¡¼¥Ë¥ó¥° [#efa8a39e]
key_buffer_size
¥¤¥ó¥Ç¥Ã¥¯¥¹¥Ö¥í¥Ã¥¯ÍѤ˻ÈÍѤ¹¤ë¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¡£
¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»È¤¦(¤Ä¤Þ¤ê¤Û¤È¤ó¤ÉÁ´¤Æ¤Î)¥¯¥¨¥ê¤Ï
¤³¤ÎÃͤˤè¤Ã¤Æ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤¬Â礤¯ÊѤï¤ê¤Þ¤¹¡£
¤è¤Ã¤Æ¡¢¤³¤ÎÃͤϲÄǽ¤Ê¸Â¤ê¡Ê¤â¤Á¤í¤ó²ÔÆ°¥·¥¹¥Æ¥à¤ÎµöÍÆÈÏ...
Â礤¯¤¹¤ë¤³¤È¤¬¿ä¾©¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
ŬÀڤʥХåե¡¥µ¥¤¥º¤òµá¤á¤ë¤Ë¤Ï¡¢SHOW STATUS ¥³¥Þ¥ó¥É¤ò...
¤³¤³¤Çɽ¼¨¤µ¤ì¤¿ Key_read_requests ¤¬¡¢¥¥ã¥Ã¥·¥å¤«¤é¤Î¥...
Key_reads ¤Ï¡¢¥Ç¥£¥¹¥¯¤«¤é¤Î¥¡¼¥Ö¥í¥Ã¥¯Æɤ߼è¤êÍ×µá²ó¿ô...
¤Ä¤Þ¤ê¡¢Key_reads / Key_read_requests ¤¬¡Ö¥¥ã¥Ã¥·¥å¥ß¥¹...
¤³¤ÎÃͤÏ0.01¤ò²¼²ó¤ë¤³¤È¤¬Îɤ¤¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¤È¤¥¥ã¥Ã¥·¥å¥ß¥¹¥ì¡¼¥È¤Ï1¡ó°Ê²¼¤Ç¤¹¡£
¤³¤ì¤ò¾å²ó¤ë¤è¤¦¤À¤Ã¤¿¤é¡¢
¥¤¥ó¥Ç¥Ã¥¯¥¹¥Ö¥í¥Ã¥¯¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÂ礤¯¤¹¤ë¤³¤È¤ò¸¡Æ¤
***my.cnf¤Î¥Ñ¥é¥á¡¼¥¿ [#g8476955]
|¥Ñ¥é¥á¡¼¥¿Ì¾|ÀßÄêÆâÍÆ|
|port = 3306|µ¯Æ°¥Ý¡¼¥ÈÈÖ¹æ|
|key_buffer = 256M|¸¡º÷¤Ë»È¤ï¤ì¤ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò¥Ð¥Ã¥Õ¥¡¤Ë...
|max_allowed_packet = 1M|ÆþÎϥǡ¼¥¿ÊÝ»ý¤ÎºÇÂç¥Ð¥Ã¥Õ¥¡¥µ¥¤...
|table_cache = 256|ÉÑÈˤʥ¢¥¯¥»¥¹¤ËÂФ·¤Æ»È¤¦¥Ç¡¼¥¿¥¥ã¥Ã...
|sort_buffer_size = 1M|ʤÙÂؤ¨¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÀßÄê¡£ÃÍ...
|read_buffer_size = 1M|Æɤ߹þ¤ß¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÀßÄê¡£ÃÍ...
|myisam_sort_buffer_size = 64M|MyISAM¤Ç»ÈÍѤ¹¤ëʤÙÂؤ¨¤Î...
|thread_cache = 8|¥¹¥ì¥Ã¥ÉÀ¸À®¤Î¥¥ã¥Ã¥·¥å¥µ¥¤¥º¤òÀßÄê¡£...
|query_cache_size= 16M|¥¯¥¨¥ê¤Î¥¥ã¥Ã¥·¥å¥µ¥¤¥º¤òÀßÄꡣƱ...
|thread_concurrency = 8|Ʊ»þ¤Ë¼Â¹Ô¤¹¤ë¥¹¥ì¥Ã¥É¿ô¤ò»ØÄê¡£|
|join_buffer_size = 131072|´°Á´·ë¹ç¡Ê¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»ÈÍѤ·...
**ODBC [#xb3e662a]
Access¤Ç¥Æ¡¼¥Ö¥ë¥ê¥ó¥¯ºîÀ®»þ¤ÎÃí°Õ
¤â¤·¤â¼ç¥¡¼¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥Æ¡¼¥Ö¥ë¤ò¥ê¥ó¥¯¤·¤¿¾ì¹ç¡¢...
¡Î¸Çͥ쥳¡¼¥É¼±Ê̻ҤÎÁªÂò¡Ï¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤ë¡£¡Ê¡¡Ë...
ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¥Æ¡¼¥Ö¥ë¤Î¹¹¿·¡¦ºï½ü¤Ê¤É¤ËºÝ¤·¤Æ¡¢...
Ʊ´ü¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£¤³¤Î¤è¤¦¤Ê²èÌ̤¬É½¼¨¤µ¤ì¤¿¾ì¹ç¤Ë...
¼ç¥¡¼¤È¤Ê¤ë¥Õ¥£¡¼¥ë¥É¤òÁªÂò¤¹¤ë¡Ê¡¡Ë¤«¡¢MySQL¥µ¡¼¥Ð¾å¤Ç...
ÀßÄꤷ¤Ê¤¤¤È¥Æ¡¼¥Ö¥ë¾å¤Ç¥Ç¡¼¥¿¤ÎÄɲᢽ¤Àµ¤¬¤Ç¤¤Ê¤¤¡£~
ReadOnly¤Ë¤Ê¤ë¤Î¤ÇÃí°Õ¤¹¤ë¡£~
&ref(MySQLODBC.png);
**Shell¤«¤é¤¤¤í¤¤¤í [#ha744e3c]
***¥Æ¥¥¹¥ÈTAB·Á¼°¤Ç¤Î¥¨¥¯¥¹¥Ý¡¼¥È [#u57fdba3]
$ /usr/bin/mysql -B --skip-column-names -u ism -p -D ecc...
from dtb_customer;' > dtb_customer.txt
Enter password:
~--skip-column-names¤¬¤Ê¤¤¾ì¹ç¤Ïcolumn-names¤â½ÐÎϤ¹¤ë¡£~
~-h 192.168.30.16 ¤Ç¥Û¥¹¥È»ØÄê
***¥Æ¥¥¹¥ÈTAB·Á¼°¤Ç¤Î¥¤¥ó¥Ý¡¼¥È [#e8c611c4]
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
Enter password:
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
»ØÄꤵ¤ì¤¿¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë̾¤Î¼ç¥Õ¥¡¥¤¥ë̾¤Ë°ìÃפ·¤¿¥Æ¡¼...
~-h 192.168.30.16 ¤Ç¥Û¥¹¥È»ØÄê --local¤Ï°ÕÌ£¤¬°ã¤¦¤Î¤ÇɬÍ×
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
192.168.30.16
Enter password:
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
''¥ª¥×¥·¥ç¥ó''~
~-l, --lock-tables
¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤ò½èÍý¤¹¤ëÁ°¤Ë¡¢¤¹¤Ù¤Æ¤Î¥Æ¡¼¥Ö¥ë¤Ø¤Î½ñ¤...
~-L, --local
¥¯¥é¥¤¥¢¥ó¥È¤«¤éÆþÎÏ¥Õ¥¡¥¤¥ë¤òÆɤ߼è¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢l...
~-r, --replace
~--replace ¥ª¥×¥·¥ç¥ó¤ª¤è¤Ó --ignore ¥ª¥×¥·¥ç¥ó¤Ï¡¢´û¸¥ì...
&color(red){defaltʸ»ú¤¬NULL¤Î¾ì¹ç¤Ï¥¨¥¯¥¹¥Ý¡¼¥È¤µ¤ì¤ë¤ÈN...
***¥Æ¡¼¥Ö¥ë¤Î¥Ç¡¼¥¿ºï½ü [#y46e11b2]
$ /usr/bin/mysql -B --skip-column-names -u ism -p -D ecc...
from dtb_customer;' -h 192.168.30.16
Enter password:
***¥Ñ¥¹¥ï¡¼¥ÉÆþ¤ì¤ë¤Ë¤Ï [#q446c790]
~--password=****¤È¤¹¤ì¤ÐÎɤ¤
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
word=**** -h 192.168.30.16
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
**EC CUBE¤ÎÊ£¿ô¤ÎŹ¤Î¥æ¡¼¥¶¤òñ°ì´ÉÍý [#g797abf6]
DB¤«¤é¥Æ¡¼¥Ö¥ë¤ò¥¨¥¯¥¹¥Ý¡¼¥È¤·¤Æ¤½¤ì¤òÊ̥ơ¼¥Ö¥ë¤Ë¥¤¥ó¥Ý...
¤¢¤ë»þ¤Ï¾å½ñ¤¤¹¤ë¡£
''tbsync.php''~
<?php
$cmd = "/usr/bin/mysql -B --skip-column-names -u ...
exec($cmd, $output);
$fp=fopen("/home/okada/temp/dtb_customer.txt","w");
foreach ($output as $a){
fputs($fp,$a."\n");
}
fclose($fp);
$cmd ="/usr/bin/mysqlimport --local eccube_ism2 /...
exec($cmd);
?>
html/entry/complete.php¤Èhtml/mypage¤Îrefusal_complete.ph...
require_once("/home/okada/temp/tbsync.php");
¤òÄɲÃ
**»²¹Í [#ncd66820]
[[MySQL¥¯¥¤¥Ã¥¯¡¦¥ê¥Õ¥¡¥ì¥ó¥¹:http://www.bitscope.co.jp/t...
[[MySQL¤ÎÊÑ¿ô:http://www.limy.org/program/db/mysql/mysql_...
---------------------------------------------------------...
RIGHT:[[¸µ¥Ú¡¼¥¸:https://wwwism.dyndns.org/hp/linux/mysql...
½ªÎ»¹Ô:
*MySQL [#m93eeef6]
RIGHT:¹¹¿·Æü &lastmod();
**MySQL¤Î¥¤¥ó¥¹¥È¡¼¥ë [#r0532473]
MySQL¤Î¥½¡¼¥¹¤ò[[¤³¤³:http://dev.mysql.com/downloads/]]¤Î...
$ su
# /usr/sbin/useradd mysql
home¥Ç¥£¥ì¥¯¥È¥ê¤ò/usr/local/var¤ËÊѹ¹
$ tar zxvf mysql-4.1.12.tar.gz
$ cd mysql-4.1.12
$ ./configure --with-charset=ujis -with-extra-charsets=a...
--with-mysqld-user=mysql
--with-charset
¥Ç¥Õ¥©¥ë¥È¤Ç»ÈÍѤµ¤ì¤ëʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Þ¤¹¡£EUC¤Ê¤éuji...
--with-extra-charset
¥Ç¥Õ¥©¥ë¥È¤Ç»ØÄꤵ¤ì¤¿Ê¸»ú¥³¡¼¥É°Ê³°¤ò¥µ¥Ý¡¼¥È¤·¤¿¤¤¾ì¹ç...
"--with-extra-charset=ujis,sjis,..."¤Î¤è¤¦¤Ë¸ÄÊ̤˻ØÄê¤Ç...
¤³¤³¤Ç¤Ï¡Èall¡É¤È¤·¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢
make¤ò¤·Ä¾¤µ¤º¤È¤â¡¢°Û¤Ê¤ëʸ»ú¥³¡¼¥É¤Ç¥µ¡¼¥Ð¤òµ¯Æ°¤¹¤ë¤³...
--with-mysqld-user
MySQL¥Ç¡¼¥â¥ó¤òµ¯Æ°¤¹¤ë¥æ¡¼¥¶¡¼¤Î»ØÄê
$ make
$ su
# make install
# cp support-files/my-medium.cnf /etc/my.cnf <---(1)
(1)¤Ç¥³¥Ô¡¼¤¹¤ë¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ
|¥Õ¥¡¥¤¥ë̾|»ÈÍÑÍÑÅÓ|
|my-small.cnf|64MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-medium.cnf|128MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-large.cnf|512MB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-huge.cnf|1GB¡Á2GB°Ê²¼¤Î¥á¥â¥ê¤òÅëºÜ¤·¤¿PC|
|my-innodb-heavy-4G.cnf|4GB¤Î¥á¥â¥ê¤ÈInnoDB¤ÇºîÀ®¤µ¤ì¤¿¥Ç...
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î½é´ü²½ [#y9e7af00]
°Ê²¼¥Ç¡¼¥¿¥Ù¡¼¥¹¥³¥Þ¥ó¥É¤òroot¤Ç¹Ô¤Ã¤Æ¤¤¤ë¤¬¥·¥¹¥Æ¥à´Ø·¸...
# /usr/local/bin/mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-fi...
to the right place for your system
(ά)
he latest information about MySQL is available on the we...
http://www.mysql.com
Support MySQL by buying support/licenses at https://orde...
# /usr/local/var(¥Ç¡¼¥¿¥Ù¡¼¥¹ÊݸÀè)¤Î¥ª¡¼¥Ê¤òÊѹ¹
# chown -R mysql.mysql /usr/local/var
**µ¯Æ° [#xb063eb2]
# /usr/local/bin/mysqld_safe --user=mysql --log &
Æ°ºî³Îǧ
--log¤Ç/usr/local/var/(¥µ¡¼¥Ð̾).log¤Çlogfile¤¬ºîÀ®¤µ¤ì¤ë
°Ê²¼¤Î¥³¥Þ¥ó¥É¤Ç·ë²Ì¤¬°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ì¤ÐOK
# /usr/local/bin/mysqlshow
+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+
Á´¤Æ¤ÎDB¤òɽ¼¨¤¹¤ë¤Ë¤Ï(root¤Î¥Ñ¥¹¥ï¡¼¥ÉÀßÄê¸å¤Ï)
$ /usr/local/bin/mysqlshow -u root -p
Enter password:*****
+-----------+
| Databases |
+-----------+
| moodle |
| mysql |
| test |
| xoops |
+-----------+
***¥Ñ¥é¥á¡¼¥¿¤Î»ØÄê [#i813e443]
¤¿¤È¤¨¤Ð¡¢MySQL¤ÎºÇÂçÀܳ¿ô¤ò¾å¤²¤ë¤Ë¤Ï¡¢mysqld¤Ë¥ª¥×¥·¥ç...
/etc/my.cnf¤Î
[mysqld]
max_connections = 120
¤ËÄɲ乤롣
''log¤Î¼è¤êÊý''
[mysqld]
log=/var/log/mysql.log
¤òÄɲÃ
# touch /var/log/mysql.log
# chown mysql.mysql /var/log/mysql.log
**MySQL¤ÎÄä»ß [#rd1407e2]
$ /usr/local/bin/mysqladmin -u root -p shutdown
**MySQL¤òÆ°¤«¤¹ [#m3fb10c4]
MySQL¤Îroot ¤Î¥Ñ¥¹¥ï¡¼¥ÉÀßÄê
$ /usr/local/bin/mysqladmin -u root password '******' <-...
¾åµ¤Îmysqladmin¤Ç¥Ñ¥¹¥ï¡¼¥É¤òÀßÄꤷ¤¿¤È¤¤Ï°Ê²¼¤Î¥³¥Þ¥ó...
$ /usr/local/bin/mysqladmin -u root -p reload
Enter password:
''root¤Î¥Ñ¥¹¥ï¡¼¥ÉÊѹ¹''
$ mysqladmin -u root -p password '******' <--NewPassword
Enter password: ******* <--OldPassword
¡Ömysqladmin -u root -p reload¡×¤¬É¬Íפ«¤ÏÉÔÌÀ
# mysql -u root -p
Enter password: <--£±(1)¤Î¥Ñ¥¹¥ï¡¼¥É¤òÆþÎÏ
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the bu...
mysql>
mysql> select host,user,password from mysql.user;
+-----------+------+------------------------------------...
| host | user | password ...
+-----------+------+------------------------------------...
| localhost | root | *3*********************************...
| open2_06 | root | ...
| open2_06 | | ...
| localhost | | ...
+-----------+------+------------------------------------...
4 rows in set (0.00 sec)
***root¤Çmysql¤Ë¥í¥°¥¤¥ó [#fcdf759e]
# mysql -u root mysql
¤â¤¦¤È¤Ä¤Îroot¤Î¥Ñ¥¹¥ï¡¼¥É¤òÀßÄê(root@open2_06)
SET PASSWORD ¹½Ê¸¤Ç¥Ñ¥¹¥ï¡¼¥É¤ÎÀßÄê¡£
mysql> SET PASSWORD FOR 'root'@'open2_06' = PASSWORD('**...
Query OK, 0 rows affected (0.00 sec)
¤¹¤Ù¤Æ¤Î¤³¤È¤¬½ÐÍè¤ëspadmin¤È¤¤¤¦¥æ¡¼¥¶¤òÅÐÏ¿(¥í¡¼¥«¥ë¤Î¤ß)
mysql> GRANT ALL PRIVILEGES ON *.* TO spadmin@localhost ...
Query OK, 0 rows affected (0.01 sec)
¥ê¥â¡¼¥È¤«¤é¤â¤¹¤Ù¤Æ¤Î¤³¤È¤¬½ÐÍè¤ë¤Ë¤Ï
mysql> GRANT ALL PRIVILEGES ON *.* TO spadmin@"%" IDENTI...
¤ÎÄɲä¬É¬Í×(¥ê¥â¡¼¥È¤«¤é¤Îµö²Ä¤òÍ¿¤¨¤ë¤Ë¤Ï¥í¡¼¥«¥ë¤âɬÍ×)
GRAN¼Â¹Ô¸å¤Ï
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
¤òɬ¤º¼Â¹Ô
Ãí¡Ë¥æ¡¼¥¶Ì¾¤Ïmysql -u¤Ç»ØÄꤷ¤Ê¤¤¸Â¤êlogin¥æ¡¼¥¶Ì¾¤Ë¤Ê¤ë
***¥Ñ¥¹¥ï¡¼¥É¤ÎÊѹ¹ [#t3f987d7]
mysql> SET PASSWORD FOR spadmin@localhost = PASSWORD('**...
Query OK, 0 rows affected (0.00 sec)
***¥æ¡¼¥¶ºï½ü [#c26fa3a9]
¥æ¡¼¥¶ºï½ü¤Ï¸¢¸Â¤òÇíÃ¥¸åºï½ü¤¹¤ë¡£¤È¤ê¤¢¤¨¤º¥í¥°¥¤¥ó¤¹¤ë
$ /usr/local/bin/mysql -u root -p mytest
''¸¢¸Â¤òÇíÃ¥(revoke)''
revoke ¸¢¸Â on ¥Ç¡¼¥¿¥Ù¡¼¥¹Ì¾.¥Æ¡¼¥Ö¥ë̾ from ¥æ¡¼¥¶Ì¾@¥Û...
mysql> revoke all on mytest.* from okada@'192.168.1.1';
Query OK, 0 rows affected (0.00 sec)
''ÅÐÏ¿¥æ¡¼¥¶¤Îºï½ü''
mysql> delete from mysql.user where host='192.168.1.1' a...
or
(mysql> DELETE FROM mysql.user WHERE user='okada';)
mysql> flush privileges;
***¥æ¡¼¥¶¤Î¸¢¸Â¤Î³Îǧ [#s4fd0cff]
¡ÖGRANT USAGE ON *.* TO 'okada'@'localhost'¡×¤Î¡Ê£±¡Ë¤Î¹Ô...
$ /usr/local/bin/mysql -u root -p
mysql> SHOW GRANTS FOR okada@localhost;
+-------------------------------------------------------...
| Grants for okada@localhost ...
+-------------------------------------------------------...
| GRANT USAGE ON *.* TO 'okada'@'localhost' IDENTIFIED B...
| GRANT ALL PRIVILEGES ON `xoops`.* TO 'okada'@'localhos...
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, IN...
DB̾(eccubu_db)¤â³Îǧ¤Ç¤¤ë
+-------------------------------------------------------...
3 rows in set (0.00 sec)
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ® [#t7e8056b]
# /usr/local/bin/mysqladmin -u root -p create mytest
ʸ»ú¥³¡¼¥É¤ò»ØÄꤷ¤Æ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºîÀ®
mysql> CREATE DATABASE hoge CHARACTER SET SJIS;
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î°ìÍ÷
# /usr/local/bin/mysqlshow -u root -p
Enter password:
+-----------+
| Databases |
+-----------+
| mysql |
| mytest |
| test |
+-----------+
¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îºï½ü
# /usr/local/bin/mysqladmin -u root -p drop (DB̾)
or
mysql> drop database (DB̾);
¤³¤Î¥³¥Þ¥ó¥É¤À¤±¤Ç¤Ïmysql.db¥Æ¡¼¥Ö¥ë¤Ë»Ä¤Ã¤Æ¤¤¤ë¤è¤¦¤Ê¤Î...
mysql> delete from mysql.db where Db='(DB̾)';
¥Æ¡¼¥Ö¥ë¤ÎºîÀ®
t_test.create
create table t_test (
ID ¡¡¡¡int8,
data2 int8,
data3 varchar(64) character set utf8
);
# /usr/local/bin/mysql -u root -p mytest < t_test.create
Enter password:
mysql> show fields from t_test;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| ID | bigint(20) | YES | | NULL | |
| data2 | bigint(20) | YES | | NULL | |
| data3 | varchar(64) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
¥Æ¡¼¥Ö¥ë°ìÍ÷
# /usr/local/bin/mysql -u root -p mytest
mysql> SHOW TABLES;
+------------------+
| Tables_in_mytest |
+------------------+
| t_test |
+------------------+
1 row in set (0.00 sec)
¥Ç¡¼¥¿¤ÎÆþÎÏÅù(postgresql¤ÈƱ¤¸)
mysql> insert into t_test values(1, 1001, 'JE2ISM');
Query OK, 1 row affected (0.00 sec)
mysql> select * from t_test;
+------+-------+--------+
| ID | data2 | data3 |
+------+-------+--------+
| 1 | 1001 | JE2ISM |
| 2 | 1002 | JF2LYU |
+------+-------+--------+
2 rows in set (0.00 sec)
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¥Ã¥¯¥¢¥Ã¥×¡¿¥ê¥¹¥È¥¢ [#kbb23c61]
***¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ð¥Ã¥¯¥¢¥Ã¥× [#q7130506]
# /usr/local/bin/mysqldump -u root -p --default-characte...
EUC¤Î¤È¤¤Ï--default-character-set=ujis¤Ë,UTF8¤Ï utf8¤Ë...
***¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥ê¥¹¥È¥¢ [#f22863ed]
Àè¤ËɬÍפʤéGRANT¤Ç¥æ¡¼¥¶Åù¤Ëµö²Ä¤òÍ¿¤¨¤ë¡£
# /usr/local/bin/mysqladmin -u root -p create mytest
# /usr/local/bin/mysql -u root -p mytest < mytest.out
¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô
# /usr/local/bin/mysqladmin flush-privileges
**¥Ç¡¼¥¿¥Ù¡¼¥¹¤Îºï½ü [#nd1143e0]
# /usr/local/bin/mysqladmin -u root -p drop mytest
Enter password:
Dropping the database is potentially a very bad thing to...
Any data stored in the database will be destroyed.
Do you really want to drop the 'mytest' database [y/N] y
Database "mytest" dropped
***¥Í¥Ã¥È¥ï¡¼¥¯¾å¤«¤éÀܳµö²Ä¤¹¤ë¤Ë¤Ï [#c39a52ac]
$ /usr/local/bin/mysql -u root -p
¤ÇÀܳ¤·¡¢µö²Ä¤¹¤ë¥æ¡¼¥¶¡¢¥Ñ¥¹¥ï¡¼¥É¡¢¥Í¥Ã¥È¥ï¡¼¥¯(¥Û¥¹...
mysql> GRANT ALL PRIVILEGES ON mytest.* TO okada@'192.16...
mysql> flush privileges;
mysql> select host,user,password from mysql.user;
+----------------------------+------------+-------------...
| host | user | password ...
+----------------------------+------------+-------------...
| localhost | root | *B**********...
| uso5004.mie-chukyo-u.ac.jp | root | ...
| localhost | | ...
| localhost | moodleuser | *B**********...
| 192.168.1.0/255.255.255.0 | okada | *3**********...
+----------------------------+------------+-------------...
6 rows in set (0.00 sec)
¥ê¥â¡¼¥È¤«¤é
°Ê²¼¤Î¥³¥Þ¥ó¥É¤ÇÀܳ
$ /usr/local/bin/mysql -u okada -p mytest -h 192.168.1.1
Enter password:
***MySQL¥µ¡¼¥Ð¡¼¤ÎÁ´ÀßÄê¾ðÊó(ÊÑ¿ô¤ä¥¹¥Æ¡¼¥¿¥¹)¤Îɽ¼¨ [#ae...
mysql> show variables;
mysql> show variables like 'key%';
--------------------------+---------+
| Variable_name | Value |
--------------------------+---------+
| key_buffer_size | 8388600 |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit| 100 |
--------------------------+---------+
4 rows in set (0.00 sec)
mysql> SHOW STATUS like 'key%';
------------------------+-------+
| Variable_name | Value |
------------------------+-------+
| Key_blocks_not_flushed| 0 |
| Key_blocks_unused | 28971 |
| Key_blocks_used | 24 |
| Key_read_requests | 231 |
| Key_reads | 24 |
| Key_write_requests | 0 |
| Key_writes | 0 |
------------------------+-------+
7 rows in set (0.00 sec)
*****MySQL¥µ¡¼¥Ð¡¼¤ÎÁ´ÀßÄê¾ðÊó(ÊÑ¿ô)¤ÎÀßÄê [#a27848f1]
/etc/my.cnf¤ËÀßÄꤹ¤ë¤³¤È¤â²Äǽ¤À¤¬¡¢Ä¾ÀÜ¥»¥Ã¥È¤·¤Æ¤â¤è¤¤¡£
mysql> set Global key_buffer_size= 33554432;
Query OK, 0 rows affected (0.01 sec)
SET GLOBAL sort_buffer_size = 10 * 1024 * 1024;
SET SESSION sort_buffer_size = 10 * 1024 * 1024;
¥·¥¹¥Æ¥àÊÑ¿ô¤Ë¤Ï¡¢¥µ¡¼¥Ð¶¦Ä̤ÎÃͤȥ»¥Ã¥·¥ç¥ó(Àܳ)¶¦Ä̤Î...
Á°¼Ô¤òÊѹ¹¤¹¤ë¤È¡¢¤½¤Î¸å³«¤«¤ì¤ëÁ´¤Æ¤Î¥»¥Ã¥·¥ç¥ó¤Ë±Æ¶Á¡¢...
***¥Æ¡¼¥Ö¥ë¤Î¥¨¥¯¥¹¥Ý¡¼¥È/¥¤¥ó¥Ý¡¼¥È [#m1fb8e3c]
''¥¨¥¯¥¹¥Ý¡¼¥È''
mysql> select * from t_test into outfile "/tmp/t_test.cs...
Ãí¡Ëmysql¼Â¹Ô¥æ¡¼¥¶¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¤È½ñ¤¹þ¤ß¸¢¸Â¤¬¤Ê...
''¥¤¥ó¥Ý¡¼¥È''
mysql> load data infile "/home/okada/mysqltest/t_test.cs...
&color(red){ʸ»ú¥³¡¼¥É¤Ë¤Ä¤¤¤Æ};~
LOAD DATA INFILE(¥¤¥ó¥Ý¡¼¥È)¤Ïcharacter_set_databaseÊÑ¿ô...
mysql> show variables like 'char%'; ¤Ç³Îǧ~
character_set_database | ujis <=EUC
-DatabaseºîÀ®»þ¤Ëdefault character set¤Ç»ØÄꤹ¤ë¡£
-LOAD DATA INFILE¤ËÌÀ¼¨Åª¤Ëcharacter set¤ò»ØÄꤹ¤ë.
character set ujis
-character_set_database¤òÊѹ¹¤¹¤ë
mysql> set character_set_database='ujis';
***DB¤ÎÊѹ¹ [#k5d794ac]
root¤Î¾ì¹ç¡¢Â¾¤ÎDB¤ËÊѹ¹¤Ç¤¤ë
mysql> use authdb
Database changed
**´Êñ¤Ê¥Á¥å¡¼¥Ë¥ó¥° [#efa8a39e]
key_buffer_size
¥¤¥ó¥Ç¥Ã¥¯¥¹¥Ö¥í¥Ã¥¯ÍѤ˻ÈÍѤ¹¤ë¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¡£
¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»È¤¦(¤Ä¤Þ¤ê¤Û¤È¤ó¤ÉÁ´¤Æ¤Î)¥¯¥¨¥ê¤Ï
¤³¤ÎÃͤˤè¤Ã¤Æ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤¬Â礤¯ÊѤï¤ê¤Þ¤¹¡£
¤è¤Ã¤Æ¡¢¤³¤ÎÃͤϲÄǽ¤Ê¸Â¤ê¡Ê¤â¤Á¤í¤ó²ÔÆ°¥·¥¹¥Æ¥à¤ÎµöÍÆÈÏ...
Â礤¯¤¹¤ë¤³¤È¤¬¿ä¾©¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
ŬÀڤʥХåե¡¥µ¥¤¥º¤òµá¤á¤ë¤Ë¤Ï¡¢SHOW STATUS ¥³¥Þ¥ó¥É¤ò...
¤³¤³¤Çɽ¼¨¤µ¤ì¤¿ Key_read_requests ¤¬¡¢¥¥ã¥Ã¥·¥å¤«¤é¤Î¥...
Key_reads ¤Ï¡¢¥Ç¥£¥¹¥¯¤«¤é¤Î¥¡¼¥Ö¥í¥Ã¥¯Æɤ߼è¤êÍ×µá²ó¿ô...
¤Ä¤Þ¤ê¡¢Key_reads / Key_read_requests ¤¬¡Ö¥¥ã¥Ã¥·¥å¥ß¥¹...
¤³¤ÎÃͤÏ0.01¤ò²¼²ó¤ë¤³¤È¤¬Îɤ¤¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¤³¤Î¤È¤¥¥ã¥Ã¥·¥å¥ß¥¹¥ì¡¼¥È¤Ï1¡ó°Ê²¼¤Ç¤¹¡£
¤³¤ì¤ò¾å²ó¤ë¤è¤¦¤À¤Ã¤¿¤é¡¢
¥¤¥ó¥Ç¥Ã¥¯¥¹¥Ö¥í¥Ã¥¯¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÂ礤¯¤¹¤ë¤³¤È¤ò¸¡Æ¤
***my.cnf¤Î¥Ñ¥é¥á¡¼¥¿ [#g8476955]
|¥Ñ¥é¥á¡¼¥¿Ì¾|ÀßÄêÆâÍÆ|
|port = 3306|µ¯Æ°¥Ý¡¼¥ÈÈÖ¹æ|
|key_buffer = 256M|¸¡º÷¤Ë»È¤ï¤ì¤ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò¥Ð¥Ã¥Õ¥¡¤Ë...
|max_allowed_packet = 1M|ÆþÎϥǡ¼¥¿ÊÝ»ý¤ÎºÇÂç¥Ð¥Ã¥Õ¥¡¥µ¥¤...
|table_cache = 256|ÉÑÈˤʥ¢¥¯¥»¥¹¤ËÂФ·¤Æ»È¤¦¥Ç¡¼¥¿¥¥ã¥Ã...
|sort_buffer_size = 1M|ʤÙÂؤ¨¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÀßÄê¡£ÃÍ...
|read_buffer_size = 1M|Æɤ߹þ¤ß¤Î¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤òÀßÄê¡£ÃÍ...
|myisam_sort_buffer_size = 64M|MyISAM¤Ç»ÈÍѤ¹¤ëʤÙÂؤ¨¤Î...
|thread_cache = 8|¥¹¥ì¥Ã¥ÉÀ¸À®¤Î¥¥ã¥Ã¥·¥å¥µ¥¤¥º¤òÀßÄê¡£...
|query_cache_size= 16M|¥¯¥¨¥ê¤Î¥¥ã¥Ã¥·¥å¥µ¥¤¥º¤òÀßÄꡣƱ...
|thread_concurrency = 8|Ʊ»þ¤Ë¼Â¹Ô¤¹¤ë¥¹¥ì¥Ã¥É¿ô¤ò»ØÄê¡£|
|join_buffer_size = 131072|´°Á´·ë¹ç¡Ê¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»ÈÍѤ·...
**ODBC [#xb3e662a]
Access¤Ç¥Æ¡¼¥Ö¥ë¥ê¥ó¥¯ºîÀ®»þ¤ÎÃí°Õ
¤â¤·¤â¼ç¥¡¼¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥Æ¡¼¥Ö¥ë¤ò¥ê¥ó¥¯¤·¤¿¾ì¹ç¡¢...
¡Î¸Çͥ쥳¡¼¥É¼±Ê̻ҤÎÁªÂò¡Ï¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤ë¡£¡Ê¡¡Ë...
ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¥Æ¡¼¥Ö¥ë¤Î¹¹¿·¡¦ºï½ü¤Ê¤É¤ËºÝ¤·¤Æ¡¢...
Ʊ´ü¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£¤³¤Î¤è¤¦¤Ê²èÌ̤¬É½¼¨¤µ¤ì¤¿¾ì¹ç¤Ë...
¼ç¥¡¼¤È¤Ê¤ë¥Õ¥£¡¼¥ë¥É¤òÁªÂò¤¹¤ë¡Ê¡¡Ë¤«¡¢MySQL¥µ¡¼¥Ð¾å¤Ç...
ÀßÄꤷ¤Ê¤¤¤È¥Æ¡¼¥Ö¥ë¾å¤Ç¥Ç¡¼¥¿¤ÎÄɲᢽ¤Àµ¤¬¤Ç¤¤Ê¤¤¡£~
ReadOnly¤Ë¤Ê¤ë¤Î¤ÇÃí°Õ¤¹¤ë¡£~
&ref(MySQLODBC.png);
**Shell¤«¤é¤¤¤í¤¤¤í [#ha744e3c]
***¥Æ¥¥¹¥ÈTAB·Á¼°¤Ç¤Î¥¨¥¯¥¹¥Ý¡¼¥È [#u57fdba3]
$ /usr/bin/mysql -B --skip-column-names -u ism -p -D ecc...
from dtb_customer;' > dtb_customer.txt
Enter password:
~--skip-column-names¤¬¤Ê¤¤¾ì¹ç¤Ïcolumn-names¤â½ÐÎϤ¹¤ë¡£~
~-h 192.168.30.16 ¤Ç¥Û¥¹¥È»ØÄê
***¥Æ¥¥¹¥ÈTAB·Á¼°¤Ç¤Î¥¤¥ó¥Ý¡¼¥È [#e8c611c4]
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
Enter password:
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
»ØÄꤵ¤ì¤¿¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë̾¤Î¼ç¥Õ¥¡¥¤¥ë̾¤Ë°ìÃפ·¤¿¥Æ¡¼...
~-h 192.168.30.16 ¤Ç¥Û¥¹¥È»ØÄê --local¤Ï°ÕÌ£¤¬°ã¤¦¤Î¤ÇɬÍ×
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
192.168.30.16
Enter password:
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
''¥ª¥×¥·¥ç¥ó''~
~-l, --lock-tables
¥Æ¥¥¹¥È¥Õ¥¡¥¤¥ë¤ò½èÍý¤¹¤ëÁ°¤Ë¡¢¤¹¤Ù¤Æ¤Î¥Æ¡¼¥Ö¥ë¤Ø¤Î½ñ¤...
~-L, --local
¥¯¥é¥¤¥¢¥ó¥È¤«¤éÆþÎÏ¥Õ¥¡¥¤¥ë¤òÆɤ߼è¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢l...
~-r, --replace
~--replace ¥ª¥×¥·¥ç¥ó¤ª¤è¤Ó --ignore ¥ª¥×¥·¥ç¥ó¤Ï¡¢´û¸¥ì...
&color(red){defaltʸ»ú¤¬NULL¤Î¾ì¹ç¤Ï¥¨¥¯¥¹¥Ý¡¼¥È¤µ¤ì¤ë¤ÈN...
***¥Æ¡¼¥Ö¥ë¤Î¥Ç¡¼¥¿ºï½ü [#y46e11b2]
$ /usr/bin/mysql -B --skip-column-names -u ism -p -D ecc...
from dtb_customer;' -h 192.168.30.16
Enter password:
***¥Ñ¥¹¥ï¡¼¥ÉÆþ¤ì¤ë¤Ë¤Ï [#q446c790]
~--password=****¤È¤¹¤ì¤ÐÎɤ¤
$ /usr/bin/mysqlimport --local eccube_ism2 dtb_customer....
word=**** -h 192.168.30.16
eccube_ism2.dtb_customer: Records: 1 Deleted: 0 Skippe...
**EC CUBE¤ÎÊ£¿ô¤ÎŹ¤Î¥æ¡¼¥¶¤òñ°ì´ÉÍý [#g797abf6]
DB¤«¤é¥Æ¡¼¥Ö¥ë¤ò¥¨¥¯¥¹¥Ý¡¼¥È¤·¤Æ¤½¤ì¤òÊ̥ơ¼¥Ö¥ë¤Ë¥¤¥ó¥Ý...
¤¢¤ë»þ¤Ï¾å½ñ¤¤¹¤ë¡£
''tbsync.php''~
<?php
$cmd = "/usr/bin/mysql -B --skip-column-names -u ...
exec($cmd, $output);
$fp=fopen("/home/okada/temp/dtb_customer.txt","w");
foreach ($output as $a){
fputs($fp,$a."\n");
}
fclose($fp);
$cmd ="/usr/bin/mysqlimport --local eccube_ism2 /...
exec($cmd);
?>
html/entry/complete.php¤Èhtml/mypage¤Îrefusal_complete.ph...
require_once("/home/okada/temp/tbsync.php");
¤òÄɲÃ
**»²¹Í [#ncd66820]
[[MySQL¥¯¥¤¥Ã¥¯¡¦¥ê¥Õ¥¡¥ì¥ó¥¹:http://www.bitscope.co.jp/t...
[[MySQL¤ÎÊÑ¿ô:http://www.limy.org/program/db/mysql/mysql_...
---------------------------------------------------------...
RIGHT:[[¸µ¥Ú¡¼¥¸:https://wwwism.dyndns.org/hp/linux/mysql...
¥Ú¡¼¥¸Ì¾: