| >> HOME >> FC5 MENU >> データベースサーバー (MySQL) |
 |
|
|
|
|
|
|
|
|
|
|
| |
[root@linux ~]# yum -y install mysql-server
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
core [1/3]
core 100% |=========================| 1.1 kB 00:00
updates [2/3]
updates 100% |=========================| 1.2 kB 00:00
extras [3/3]
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 359 kB 00:02
updates : ################################################## 1029/1029
Added 64 new packages, deleted 115 old in 7.29 seconds
primary.xml.gz 100% |=========================| 1.2 MB 00:04
extras : ################################################## 4316/4316
Added 127 new packages, deleted 54 old in 18.59 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql-server to pack into transaction set.
mysql-server-5.0.22-1.FC5 100% |=========================| 34 kB 00:00
---> Package mysql-server.i386 0:5.0.22-1.FC5.1 set to be updated
--> Running transaction check
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: mysql = 5.0.22-1.FC5.1 for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-DBD-MySQL to pack into transaction set.
perl-DBD-MySQL-3.0004-1.F 100% |=========================| 8.7 kB 00:00
---> Package perl-DBD-MySQL.i386 0:3.0004-1.FC5 set to be updated
---> Downloading header for perl-DBI to pack into transaction set.
perl-DBI-1.50-2.2.i386.rp 100% |=========================| 17 kB 00:00
---> Package perl-DBI.i386 0:1.50-2.2 set to be updated
---> Downloading header for mysql to pack into transaction set.
mysql-5.0.22-1.FC5.1.i386 100% |=========================| 37 kB 00:00
---> Package mysql.i386 0:5.0.22-1.FC5.1 set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql-server i386 5.0.22-1.FC5.1 updates 9.9 M
Installing for dependencies:
mysql i386 5.0.22-1.FC5.1 updates 3.0 M
perl-DBD-MySQL i386 3.0004-1.FC5 updates 147 k
perl-DBI i386 1.50-2.2 core 581 k
Transaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 14 M
Downloading Packages:
(1/4): perl-DBD-MySQL-3.0 100% |=========================| 147 kB 00:00
(2/4): perl-DBI-1.50-2.2. 100% |=========================| 581 kB 00:01
(3/4): mysql-server-5.0.2 100% |=========================| 9.9 MB 00:32
(4/4): mysql-5.0.22-1.FC5 100% |=========================| 3.0 MB 00:09
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-DBI ######################### [1/4]
Installing: mysql ######################### [2/4]
Installing: perl-DBD-MySQL ######################### [3/4]
Installing: mysql-server ######################### [4/4]
Installed: mysql-server.i386 0:5.0.22-1.FC5.1
Dependency Installed: mysql.i386 0:5.0.22-1.FC5.1 perl-DBD-MySQL.i386 0:3.0004-1.FC5 perl-DBI.i386 0:1.50-2.2
Complete!
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
Old_passwords=1
default-table-type=InnoDB
default-character-set=ujis
init-connect=SET NAMES ujis
[mysql]
default-character-set=ujis
[mysqldump]
default-character-set=ujis
[client]
default-character-set=ujis
[mysql.server]
default-character-set=ujis
user=mysql
basedir=/var/lib
[mysqld_safe]
default-character-set=ujis
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# rm -rf /var/lib/mysql/*
|
|
|
| |
|
|
| |
[root@linux ~]# mysql_install_db
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h linux.mountainbigroad.jp password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
|
|
|
|
|
|
| |
|
|
| |
[root@linux ~]# service mysqld start
MySQL を起動中: [ OK ]
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# chkconfig mysqld on
[root@linux ~]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
|
|
| |
|
|
| |
|
|
| |
|
|
| |
mysql> select user,host,password from mysql.user;
+------+--------------------------+----------+
| user | host | password |
+------+--------------------------+----------+
| root | localhost | |
| root | linux.mountainbigroad.jp | |
| | linux.mountainbigroad.jp | |
| | localhost | |
+------+--------------------------+----------+
4 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
|
|
| |
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.01 sec)
mysql> select user,host,password from mysql.user;
+------+--------------------------+----------+
| user | host | password |
+------+--------------------------+----------+
| root | localhost | |
| root | linux.mountainbigroad.jp | |
+------+--------------------------+----------+
2 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
|
|
| |
mysql> set password for root@localhost=password('Password');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for root@linux.mountainbigroad.jp=password('Password');
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+--------------------------+-------------------+
| user | host | password |
+------+--------------------------+-------------------+
| root | localhost | |
| root | linux.mountainbigroad.jp | |
+------+--------------------------+-------------------+
2 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
|
|
| |
mysql> drop database test;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> exit
Bye
[root@linux ~]#
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
| |
[root@linux ~]# mysql -u root -pPassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
|
|
| |
|
|
| |
|
|
| |
mysql> grant all privileges on testdb.* to fedora@localhost identified by 'Password';
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+--------+--------------------------+-------------------+
| user | host | password |
+--------+--------------------------+-------------------+
| root | localhost | 5d2e19393cc5ef67 |
| root | linux.mountainbigroad.jp | 5d2e19393cc5ef67 |
| | | |
+--------+--------------------------+-------------------+
3 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> exit
Bye
[root@linux ~]# mysql -u fedora -pPassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
|
|
| |
|
|
| |
mysql> create database testdb;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| |
+--------------------+
2 rows in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> use testdb
Database changed
|
|
|
| |
|
|
| |
mysql> create table testtbl(num int, name varchar(50));
Query OK, 0 rows affected (0.04 sec)
mysql> show tables;
+------------------+
| Tables_in_testdb |
+------------------+
| |
+------------------+
1 row in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> insert into testtbl values(1,'鈴木 一太郎');
Query OK, 1 row affected (0.02 sec)
mysql> select * from testtbl;
+------+-------------+
| num | name |
+------+-------------+
| | |
+------+-------------+
1 row in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> update testtbl set name='鈴木 一之介' where num=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from testtbl;
+------+-------------+
| num | name |
+------+-------------+
| 1 | |
+------+-------------+
1 row in set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> delete from testtbl where num=1;
Query OK, 1 row affected (0.01 sec)
mysql> select * from testtbl;
Empty set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> drop table testtbl;
Query OK, 0 rows affected (0.01 sec)
mysql> show tables;
Empty set (0.00 sec)
|
|
|
| |
|
|
| |
mysql> drop database testdb;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
|
|
|
| |
|
|
| |
|
|
| |
mysql> exit
Bye
[root@linux ~]# mysql -u root -pPassword
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
|
|
| |
|
|
| |
mysql> revoke all privileges on *.* from fedora@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from mysql.user where user='fedora' and host='localhost';
Query OK, 1 row affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+--------+--------------------------+-------------------+
| user | host | password |
+--------+--------------------------+-------------------+
| root | localhost | 451b483e5c7325d5 |
| root | linux.mountainbigroad.jp | 451b483e5c7325d5 |
+--------+--------------------------+-------------------+
2 rows in set (0.00 sec)
|
|
|
 |
|
 |
 |