さくらVPSにMySQL-communication-server 5.6を入れました
こんにちは!くまかけです。
Redmineを設定する為にMySQL5.6をcommunication-serverで入れてみました。
■ MySQLのインストール
#yum install mysql-community-release-el6-5.noarch.rpm
下記が追加されました。
mysql-community-source.repo
mysql-community.repo
#yum info mysql-community-server
Name : mysql-community-server
Arch : x86_64
Version : 5.6.23
Release : 2.el6
Size : 53 M
Repo : mysql56-community
# yum install mysql-community-server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
====================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: mysql-community-libs x86_64 5.6.23-2.el6 mysql56-community 1.9 M replacing mysql-libs.x86_64 5.1.67-1.el6_3 mysql-community-libs-compat x86_64 5.6.23-2.el6 mysql56-community 1.6 M replacing mysql-libs.x86_64 5.1.67-1.el6_3 mysql-community-server x86_64 5.6.23-2.el6 mysql56-community 53 M Installing for dependencies: mysql-community-client x86_64 5.6.23-2.el6 mysql56-community 18 M mysql-community-common x86_64 5.6.23-2.el6 mysql56-community 307 k perl-DBI x86_64 1.609-4.el6 base 705 k Updating for dependencies: postfix x86_64 2:2.6.6-6.el6_5 base 2.0 M Transaction Summary ====================================================================================================================================== Install 6 Package(s) Upgrade 1 Package(s) |
#mysqld –version
mysqld Ver 5.6.23 for Linux on x86_64 (MySQL Community Server (GPL))
自動起動を設定します
# chkconfig mysqld on
# chkconfig –list | grep mysql
1 |
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
MySQLを起動します
# service mysqld start
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
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 www6351ui.sakura.ne.jp 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. Please report any problems at http://bugs.mysql.com/ 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 Note: new default config file not created. Please make sure your config file is current WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server [ OK ] Starting mysqld: [ OK ] |
セキュリティの設定しなさい!ってメッセージが出てますね。。
セキュリティの初期設定をします
下記の設定をします。
・rootパスワードの設定
・anonymousユーザーの削除
・リモートからのrootユーザログインの禁止
・testテーブルの削除
#mysql_secure_installation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. <span style="color: #339966;">Set root password? [Y/n] Y</span> New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. <span style="color: #339966;">Remove anonymous users? [Y/n] Y</span> ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. <span style="color: #339966;">Disallow root login remotely? [Y/n] Y</span> ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. <span style="color: #339966;">Reload privilege tables now? [Y/n] Y</span> ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up… |
■Redmine用のデータベースを作成する
ユーザー:admin
パスワード:passwd
データベース:redmine
$mysql -u root -p
mysql> show character set;
1 2 3 4 5 |
+----------+-----------------------------+---------------------+--------+ | Charset | Description | Default collation | Maxlen | +----------+-----------------------------+---------------------+--------+ | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | +----------+-----------------------------+---------------------+--------+ |
mysql> create database redmine character set utf8;
mysql> show create database redmine;
1 2 3 4 5 |
+----------+------------------------------------------------------------------+ | Database | Create Database | +----------+------------------------------------------------------------------+ | redmani | CREATE DATABASE `redmine` /*!40100 DEFAULT CHARACTER SET utf8 */ | +----------+------------------------------------------------------------------+ |
mysql> create user ‘admin’@’localhost’ identified by ‘passwd’;
mysql> select User,Host from mysql.user;
1 2 3 4 5 |
+---------+-----------+ | User | Host | +---------+-----------+ | admin | localhost | +---------+-----------+ |
mysql> grant all on redmine.* to admin;
mysql> show grants for ‘admin’@’localhost’ \G
1 2 |
*************************** 1. row *************************** Grants for admin@localhost: GRANT USAGE ON *.* TO 'admin'@'localhost' IDENTIFIED BY PASSWORD ‘*xx' |
■ソースが必要な場合は・・・
commucation-develをインストールします。
# yum install mysql-community-devel.x86_64
1 2 3 4 5 6 7 8 9 |
============================================================================================================================ Package Arch Version Repository Size ============================================================================================================================ Installing: mysql-community-devel x86_64 5.6.23-2.el6 mysql56-community 3.3 M Transaction Summary ============================================================================================================================ Install 1 Package(s) |