Wednesday, January 30, 2019

MySQL: install in centos

新增rpm和進行下載
sudo yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
sudo yum install mysql-community-server

開啓mysql
sudo systemctl enable mysqld
sudo systemctl start mysqld
sudo systemctl status mysqld

查看預設密碼
sudo grep 'temporary password' /var/log/mysqld.log
使用預設密碼來設定新密碼。(新密碼需要8個字符以上,包括至少各一個︰大寫字母、小寫字母、數字、特殊符號)
sudo mysql_secure_installation

登入
mysql -u root -p

輸入指令
create database xxx;

use database xxx;

create table ...

select ...



No comments: