ขั้นตอนติดตั้ง MySQL 5.7 on CentOS 7

ขั้นตอนติดตั้ง MySQL 5.7 on CentOS 7

 

หลังจากได้ทำการติดตั้ง MySQL และทำการ Start service ขึ้นมาเรียบร้อยแล้ว ต่อมาเราจะต้องทำการตั้งค่า Password เพื่อเข้าใช้งานได้ดังนี้

 

1. #yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm    

2. #yum install mysql-community-server         <--- ติดตั้งแพคเกจ MySQL 5.7

3. #systemctl enable mysqld.service               <--- ทำการเปิด MySQL เมื่อเวลามีการ Reboot MySQL จะทำการ Start service โดยอัตโนมัติ

4. #systemctl start mysqld.service                  <--- ทำการ Start service

5. #systemctl status mysqld.service                <--- ตรวจสอบสถานะการทำงานของ MySQL

 

6. ทำการเปิด Password ชั่วคราวเพื่อนำไปรันการติดตั้ง

#grep 'temporary password' /var/log/mysqld.log

 

OUTPUT

2019-05-02T04:59:21.613658Z 1 [Note] A temporary password is generated for root@localhost: #yIqtUyK)3RT


7. Run คำสั่งเพื่อติดตั้งและกำหนด Password ใหม่

[root@testtest ~]# mysql_secure_installation

 

Securing the MySQL server deployment.

 

Enter password for user root:       <----- นำ Password ที่ได้จากขั้นตอนแรกมาใส่


ต่อมาระบบจะให้ทำการกรอก Password ใหม่ เป็นอันเสร็จสิ้น

 

8. ทำการ Login MySQL เพื่อเข้าใช้งาน


[root@testtest ~]# mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.26 MySQL Community Server (GPL)

 

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

 

 

 

เริ่มสร้างฐานข้อมูลกันได้เลย


Was this article helpful?

mood_bad Dislike 0
mood Like 3
visibility Views: 10224