Help us understand the problem. What is going on with this article?

EC2 MySQL 初期設定 root にパスワードの設定

More than 1 year has passed since last update.

前提条件

EC2にMySQLのインストールがすんでいる

設定

[ec2-user@ip-・・・・・ ~]$ sudo /etc/init.d/mysqld start
                                                              [OK]

起動

[ec2-user@ip-・・・・・ ~]$ sudo mysql_secure_installation
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): 

「Enterキー」

OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y

パスワードをセットするか聞かれるから「yキー」から「Enterキー」

New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

設定するパスワードを入力して「Enterキー」
確認で求められるから、もう1度、入力

Remove anonymous users? [Y/n] y
 ... Success!

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...

上から、
- 匿名ユーザーを削除するかどうか。
- rootユーザーのリモートホストからのログインを無効化するかどうか。
- testデータベースを削除するか。
- これらの変更を即座に反映するか。
全部問題無いので「yキー」から「Enterキー」

Thanks for using MySQL!

設定完了

ログイン

[ec2-user@ip-・・・・・・ ~]$ mysql -u root -p
Enter password: 

先ほど設定したパスワードを入力

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.5.60 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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>

実際に入れたら成功

TeamDowel
「チームラボ」に憧れるがIT方面とは全く関係のない能力が無駄に突出している最強の素人集団!関係ない能力も無駄に「繋」がれば立派なアイディアになると信じて今日も行く!(とは言えWebアプリ/ネイティブアプリ/インフラ関係の仕事にそれぞれ従事しております)
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした