LoginSignup
5
4

More than 5 years have passed since last update.

centOSにMySQLをインストール

Last updated at Posted at 2016-03-05

環境

centOS:6.2
MySQL:5.1

インストール

$ sudo yum -y install mysql-server

設定ファイル

$ sudo vi /etc/my.cnf
my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8 #追加する

[client]
default-character-set=utf8 #追加する

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

起動

初期設定するより先に起動しないとmysql.sockが無いってエラーが出る

$ sudo /etc/rc.d/init.d/mysqld start

自動起動ONにする

$ sudo chkconfig mysqld on

初期設定

$ mysql_secure_installation

すると

Enter current password for root (enter for none): 

と聞かれるが何も入力せずにEnter

Set root password? [Y/n]

はもちろんY。そして新規パスワード&確認用パスワードを入力する。

これ以降に聞かれる

Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]

はEnter入力しておけばよい。
thanks_mysql.png
これが出ればOK

参考サイト

centOSにMySQLをインストール(自分のブログ)
データベースサーバー構築(MySQL)

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4