rpmでのmysqlのセットアップ(Syslog連携、vim風にする)

記憶が飛ぶ orz のでメモ

というか、rsyslogとDBとの連携とかで試してみて

http://www.usupi.org/sysad/207.html
http://www.usupi.org/sysad/208.html
http://www.usupi.org/sysad/209.html

すでにうちの実機では動いているんですが、全て忘却しているので、
mysqlの使い方の復習もかねる

[root@localhost init.d]# yum install mysql-server

Install       3 Package(s)

(1/3): mysql-server-5.1.66-1.el6_3.i686.rpm              | 8.8 MB     00:50     
(2/3): perl-DBD-MySQL-4.013-3.el6.i686.rpm               | 134 kB     00:00     
(3/3): perl-DBI-1.609-4.el6.i686.rpm                     | 705 kB     00:04     


[root@localhost init.d]# 
[root@localhost init.d]# 
[root@localhost init.d]# 
[root@localhost init.d]# which mysql
/usr/bin/mysql
[root@localhost init.d]# 
[root@localhost init.d]# 
[root@localhost init.d]# chkconfig mysqld on
[root@localhost init.d]# 
[root@localhost init.d]# /etc/init.d/mysqld start
MySQL データベースを初期化中:  Installing MySQL system tables...
OK
Filling help tables...
OK

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 localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

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 mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]
[root@localhost init.d]# 


#mysqladmin -u root password 'yourpassword'
にてアカウント作成

ここで、文字化け対策をしとなんとあかんな
http://d.hatena.ne.jp/toshi_hirasawa/20120825/1345873864

[hirasawa@cent5-64b-40 ~]$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| Syslog             | 
| mysql              | 
+--------------------+
3 rows in set (0.00 sec)

mysql> 
mysql> use Syslog
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+------------------------+
| Tables_in_Syslog       |
+------------------------+
| SystemEvents           | 
| SystemEventsProperties | 
+------------------------+
2 rows in set (0.00 sec)

mysql> 


つづいてreadlineをつかってvi風にする。

The MySQL command line interface uses readline to edit a command line.

Create a file ~/.inputrc with the following content to use vi mode:

$if mysql
set editing-mode vi
$endif

Of course, if you want to use vi mode in all applications (including
e.g. bash) that use readline, you can leave out the $if & $endif ...
lines...

I followed below procdure

http://y-kit.jp/saba/xp/mysqltry2.htm

Good!!