Installation and basic configuration of 02:mysql

Source: Internet
Author: User

1.1 MySQL Installation and basic configuration (CentOS 7.3)

1. Install MySQL using yum

Yum Install Mysql-community-server

2. Common commands for MySQL management

Systemctl Status Mysqld
Systemctl Start mysqld
Systemctl Stop Mysqld

3. Boot start

Systemctl Enable Mysqld
Systemctl Daemon-reload

4, after the successful installation of MySQL, the default root user password is empty, you can log in directly

Mysql-uroot-p
mysqladmin-u root Password "1" # to root user password: 1
MYSQL-UROOT-P1 # must be logged in with a password after configuring the password

1.2 Modifying the MySQL default character set and engine

1. Installing MySQL using a foreign key association to create a table fails because the default engine is not

2. inserting a Chinese discovery to MySQL displays garbled because the default character set is incorrect

Show variables like ' character% '; #查看MySQL默认字符集

3. The workaround is to modify the mysql configuration file vim/etc/my.cnf

VIM/ETC/MY.CNF        # The content below is what you add [mysqld]default-storage-engine=innodbdefault_ Character_set=utf8character_set_server=utf8[mysqld_safe]default-character-set = utf8[ Client]default-character-set = UTF8 [mysql.server]default-character-set = UTF8 [mysql]default -character-set = UTF8
vim/etc/my.cnf

4. Interview question: What storage engine does your database use? What's the difference?

1. MyISAM and InnoDB are common.
2. InnoDB: Support foreign KEY constraints, support transactions. The indexes are handled separately, without referencing the index.
3. MyISAM: Foreign KEY constraints are not supported, transactions are not supported, and when large batches are imported into the data, it is indexed by the edge of the data edge.
Therefore, in order to improve the efficiency of execution, the index should be disabled first, after the full import and then open the index

1.3 MySQL Create user and authorization

Installation and basic configuration of 02:mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.