Alibaba Cloud Centos 7.5 Installing Mysql Tutorial

  • 2021-08-28 21:22:42
  • OfStack

It seems that there is no mysql-sever file when MySQL is installed normally in yum source of CentOS 7, so it needs to be downloaded from official website.


# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 
# rpm -ivh mysql-community-release-el7-5.noarch.rpm 
# yum install mysql-community-server

Restart the mysql service after successful installation


# service mysqld restart

The first installation of mysql is root. The account has no password

The method statement for setting the password ends with a semicolon


# mysql -uroot 
mysql> set password for  ' root'@ ' localhost' = password('mypasswd');

Create a database and specify utf-8 encoding


mysql> CREATE DATABASE xxxx DEFAULT CHARSET utf8 COLLATE utf8_general_ci

Import database


mysql>use  Database  
--  Then use the source Command, followed by script files ( As used here .sql) 
mysql>source dbname.sql

Related articles: