MySQLインストール

centosへのMySQLインストール
インストール準備(epelインストール)
最新のバージョンを落とす為、yumに外部レポジトリをする方法が一般的?ですが、
例)
| 1 2 3 4 5 6 7 8 9 10 |  # rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm  # vi /etc/yum.repos.d/epel.repo [epel] name=Extra Packages for Enterprise Linux 5 - $basearch #baseurl=http://dl.fedoraproject.org/pub/epel/5/$basearch mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch failovermethod=priority enabled=1 Show full text | 
今回はyumに直接入れます。
| 1 2 |  # yum install -y  http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm | 
確認
| 1 2 3 4 5 6 7 8 9 10 |  # less /etc/yum.repos.d/mysql-community.repo [mysql-connectors-community] name=MySQL Connectors Community baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql ... | 
yum infoでも確認
| 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 |  # yum info mysql-community-server Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp mysql-connectors-community                                                   | 2.5 kB     00:00     mysql-connectors-community/primary_db                                        | 6.2 kB     00:00     mysql-tools-community                                                        | 2.5 kB     00:00     mysql-tools-community/primary_db                                             |  13 kB     00:00     mysql56-community                                                            | 2.5 kB     00:00     mysql56-community/primary_db                                                 |  40 kB     00:00     Available Packages Name        : mysql-community-server Arch        : x86_64 Version     : 5.6.19 Release     : 2.el6 Size        : 52 M Repo        : mysql56-community Summary     : A very fast and reliable SQL database server URL         : http://www.mysql.com/ License     : Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Under : GPLv2 license as shown in the Description field. Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, : and robust SQL (Structured Query Language) database server. MySQL Server : is intended for mission-critical, heavy-load production systems as well : as for embedding into mass-deployed software. MySQL is a trademark of : Oracle and/or its affiliates : : The MySQL software has Dual Licensing, which means you can use the MySQL : software free of charge under the GNU General Public License : (http://www.gnu.org/licenses/). You can also purchase commercial MySQL : licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms : of the GPL. See the chapter "Licensing and Support" in the manual for : further info. : : The MySQL web site (http://www.mysql.com/) provides the latest news and : information about the MySQL software.  Also please see the documentation : and the manual for more information. : : This package includes the MySQL server binary as well as related utilities : to run and administer a MySQL server. Show full text | 
インストール
最新の5.6が確認できたのでインストール。
| 1 2 3 4 5 6 7 8 9 10 11 12 |  # yum install mysql-community-server Downloading Packages: (1/5): mysql-community-client-5.6.19-2.el6.x86_64.rpm                        |  18 MB     00:06     (2/5): mysql-community-common-5.6.19-2.el6.x86_64.rpm                        | 298 kB     00:00     (3/5): mysql-community-libs-5.6.19-2.el6.x86_64.rpm                          | 1.9 MB     00:00     (4/5): mysql-community-libs-compat-5.6.19-2.el6.x86_64.rpm                   | 1.6 MB     00:00     (5/5): mysql-community-server-5.6.19-2.el6.x86_64.rpm                        |  52 MB     00:18   途中5つの依存関係のあるパッケージをインストールして完了 Show full text | 
mysqlサービス開始
| 1 2 |  # service mysqld start | 
パスワードなしで接続確認
| 1 2 3 4 5 6 | ~ # mysql -uroot -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.19 MySQL Community Server (GPL) | 
パスワードを設定
| 1 2 3 | mysql> SET PASSWORD FOR root@localhost=PASSWORD('password'); mysql> exit; | 
| 1 2 | ~ # mysql_secure_installation | 
いくつか設定の質問があるので対応。
| 1 2 3 4 5 6 | Change the root password? [Y/n] n              # rootパスワードを変更するか Remove anonymous users? [Y/n] Y                # 匿名ユーザを削除するか Disallow root login remotely? [Y/n] Y          # root ユーザでのリモートからのログインを禁止するか Remove test database and access to it? [Y/n] Y # test データベースを削除するか Reload privilege tables now? [Y/n] Y           # 権限テーブルをリロードするか | 
5.6への接続完了
自動起動を忘れずに
| 1 2 |  # chkconfig mysqld on | 



![php開発中にWarning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) …… が出たとき](http://tech.alters.co.jp/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/29.jpg)


