文書更新:2018年05月31日(木) 午前10時12分37秒

Home > 備忘録 > MySQL に関すること > MySQL のインストール( 92 )

MySQLのインストール

[root@server]# yum -y install mysql-server

MySQLの設定

[root@server]# vi /etc/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	←追加
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

MySQLの起動

[root@server]# /etc/rc.d/init.d/mysqld start

MySQLの自動起動設定

[root@server]# chkconfig mysqld on

MySQLの初期設定

[root@server]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
	~~~~~途中省略~~~~~
so you should just press enter here.

Enter current password for root (enter for none):	←ENTERを押す
OK, successfully used password, moving on...
	~~~~~途中省略~~~~~
Set root password? [Y/n]	←ENTERを押す(rootパスワード設定)
New password: 	←ENTERを押す(rootパスワード入力)	※このパスワードはMySQLに接続するときに使用
Re-enter new password: 	←ENTERを押す(rootパスワード再入力)
Password updated successfully!
Reloading privilege tables..
 ... Success!
	~~~~~途中省略~~~~~
Remove anonymous users? [Y/n]	←ENTERを押す(匿名ユーザー削除)
 ... Success!
	~~~~~途中省略~~~~~
Disallow root login remotely? [Y/n]	←ENTERを押す(リモートからのrootログイン禁止)
 ... Success!
	~~~~~途中省略~~~~~
Remove test database and access to it? [Y/n]	←ENTERを押す
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
	~~~~~途中省略~~~~~
Reload privilege tables now? [Y/n]	←ENTERを押す
 ... Success!

Cleaning up...
	~~~~~途中省略~~~~~
Thanks for using MySQL!