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