16 02 2021
Centos 7 mysql8 install
1)yum localinstall 명령어로 MySQL rpm 패키지 설치
[root@hae ~]# yum repolist enabled | grep "mysql.*-community.*"
[root@hae ~]# sudo yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Loaded plugins: fastestmirror
mysql80-community-release-el7-3.noarch.rpm | 25 kB 00:00:00
Examining /var/tmp/yum-root-tl7kMk/mysql80-community-release-el7-3.noarch.rpm: mysql80-community-release-el7-3.noarch
Marking /var/tmp/yum-root-tl7kMk/mysql80-community-release-el7-3.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-3 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================================================================================================================
Installing:
mysql80-community-release noarch el7-3 /mysql80-community-release-el7-3.noarch 31 k
Transaction Summary
=================================================================================================================================================================================================================================================================================================================
Install 1 Package
Total size: 31 k
Installed size: 31 k
Is this ok [y/d/N]: yes
Is this ok [y/d/N]: yes
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mysql80-community-release-el7-3.noarch 1/1
Verifying : mysql80-community-release-el7-3.noarch 1/1
Installed:
mysql80-community-release.noarch 0:el7-3
Complete!
2)확인
[root@hae ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 185
mysql-tools-community/x86_64 MySQL Tools Community 123
mysql80-community/x86_64 MySQL 8.0 Community Server 229
3)설치
[root@hae ~]# yum install mysql-community-server
4)my.cnf설정
[root@hae ~]# vi /etc/my.cnf
CharacterSet UTF8 설정하기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqldump] default-character-set=utf8 [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove the leading "# " to disable binary logging # Binary logging captures changes between backups and is enabled by # default. It's default setting is log_bin=binlog # disable_log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M # # Remove leading # to revert to previous value for default_authentication_plugin, # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid character-set-server=utf8 collation-server=utf8_general_ci init_connect=SET collation_connection = utf8_general_ci init_connect=SET NAMES utf8 character-set-client-handshake = FALSE skip-character-set-client-handshake symbolic-links=0 |
5.mysql start
[root@hae ~]# systemctl start mysqld
6.root 의 임시비밀번호 확인
mysql 서비스를 시작하면 /var/log/mysqld.log 에
임시비밀번호가 적혀 있습니다.
cat, vi 로 확인하세요.
2021-02-16T16:01:32.809781Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-02-16T16:01:34.354853Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: %Z#
2021-02-16T16:01:38.051654Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
7.root 로 로그인 에러의 경우 해결
[root@hae zones]# mysql -u -root -p
Enter password:
mysql> alter user ‘root’@’localhost’ identified by ‘비밀번호’;
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Comments are currently closed.