操作系统:
2.6.32-754.10.1.el6.x86_64
MySQL版本:8.0.16
下载地址:https://dev.mysql.com/downloads/
安装方法:
使用rpm安装
[[email protected]]# cd /opt/*******/data [[email protected]]# mkdir mysql [[email protected]]# tar xvf /var/tmp/mysql-8.0.16-1.el6.x86_64.rpm-bundle.tar -C /opt/ericsson/data/mysql/ mysql-community-test-8.0.16-1.el6.x86_64.rpm mysql-community-libs-compat-8.0.16-1.el6.x86_64.rpm mysql-community-devel-8.0.16-1.el6.x86_64.rpm mysql-community-server-8.0.16-1.el6.x86_64.rpm mysql-community-client-8.0.16-1.el6.x86_64.rpm mysql-community-common-8.0.16-1.el6.x86_64.rpm mysql-community-libs-8.0.16-1.el6.x86_64.rpm [[email protected] data]# cd mysql/ [[email protected] mysql]# ls -lh total 646M -rw-r--r-- 1 7155 31415 37M Apr 15 15:52 mysql-community-client-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 710K Apr 15 15:52 mysql-community-common-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 6.0M Apr 15 15:52 mysql-community-devel-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 3.4M Apr 15 15:52 mysql-community-libs-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 1.7M Apr 15 15:52 mysql-community-libs-compat-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 481M Apr 15 15:52 mysql-community-server-8.0.16-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 117M Apr 15 15:54 mysql-community-test-8.0.16-1.el6.x86_64.rpm [[email protected] mysql]# rpm -ivh mysql-community-common-8.0.16-1.el6.x86_64.rpm warning: mysql-community-common-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-common ########################################### [100%] [[email protected] mysql]# rpm -ivh mysql-community-libs-8.0.16-1.el6.x86_64.rpm warning: mysql-community-libs-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-libs ########################################### [100%] [[email protected]]# rpm -ivh mysql-community-server-8.0.16-1.el6.x86_64.rpm warning: mysql-community-server-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-client(x86-64) >= 8.0.11 is needed by mysql-community-server-8.0.16-1.el6.x86_64 //先安装client [[email protected]]# rpm -ivh mysql-community-client-8.0.16-1.el6.x86_64.rpm warning: mysql-community-client-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-client ########################################### [100%] [[email protected]]# rpm -ivh mysql-community-server-8.0.16-1.el6.x86_64.rpm warning: mysql-community-server-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] file /etc/my.cnf from install of mysql-community-server-8.0.16-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64 安装的时候没有注意到这个冲突,导致无法启动MySQL,实际是MySQL server没有安装成功 [[email protected]]# rpm -ivh mysql-community-devel-8.0.16-1.el6.x86_64.rpm warning: mysql-community-devel-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: pkgconfig(openssl) is needed by mysql-community-devel-8.0.16-1.el6.x86_64 //有依赖 [[email protected]]# rpm -ivh mysql-community-libs-compat-8.0.16-1.el6.x86_64.rpm warning: mysql-community-libs-compat-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] file /usr/lib64/mysql/libmysqlclient.so.16.0.0 from install of mysql-community-libs-compat-8.0.16-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64 file /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 from install of mysql-community-libs-compat-8.0.16-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64 //有冲突 [[email protected] mysql]# rpm -ivh mysql-community-devel-8.0.16-1.el6.x86_64.rpm --nodeps //使用参数 warning: mysql-community-devel-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-devel ########################################### [100%] [[email protected]]# [[email protected] mysql]# rpm -ivh mysql-community-test-8.0.16-1.el6.x86_64.rpm --nodeps warning: mysql-community-test-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-test ########################################### [100%] 安装完发现无法启动MySQL [[email protected] mysql]# /etc/init.d/mysqld start -bash: /etc/init.d/mysqld: No such file or directory [[email protected] mysql]# mysql_install_db /var/lib/mysql -bash: mysql_install_db: command not found [[email protected]]# mysqld --initialize -bash: mysqld: command not found 重新安装MySQL server发现报错 [[email protected] mysql]# rpm -ivh mysql-community-server-8.0.16-1.el6.x86_64.rpm warning: mysql-community-server-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] file /etc/my.cnf from install of mysql-community-server-8.0.16-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64 [[email protected] mysql]# [[email protected] mysql]# rpm -qa | grep -i mysql mysql-libs-5.1.73-5.el6_6.x86_64 mysql-community-libs-8.0.16-1.el6.x86_64 mysql80-community-release-el6-3.noarch mysql-community-devel-8.0.16-1.el6.x86_64 mysql-community-common-8.0.16-1.el6.x86_64 mysql-community-test-8.0.16-1.el6.x86_64 mysql-community-client-8.0.16-1.el6.x86_64 [[email protected] mysql]# 删除旧版本的libs mysql-libs-5.1.73-5.el6_6.x86_64 [[email protected] mysql]# rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 error: Failed dependencies: libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64 libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64 [[email protected] mysql]# [[email protected] mysql]# rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps [[email protected] mysql]# rpm -qa | grep -i mysql mysql-community-libs-8.0.16-1.el6.x86_64 mysql80-community-release-el6-3.noarch mysql-community-devel-8.0.16-1.el6.x86_64 mysql-community-common-8.0.16-1.el6.x86_64 mysql-community-test-8.0.16-1.el6.x86_64 mysql-community-client-8.0.16-1.el6.x86_64 [[email protected] mysql]# 安装mysql-community-server [[email protected] mysql]# rpm -ivh mysql-community-server-8.0.16-1.el6.x86_64.rpm warning: mysql-community-server-8.0.16-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:mysql-community-server ########################################### [100%] [[email protected] mysql]# [[email protected] mysql]# 启动MySQL [[email protected] mysql]# service mysqld start Initializing MySQL database: [ OK ] Starting mysqld: [ OK ] [[email protected] mysql]# uname -r 2.6.32-754.10.1.el6.x86_64
[[email protected] mysql]# grep ‘temporary password‘ /var/log/mysqld.log 2019-04-29T14:33:46.158054Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: t=Njoyw42aRU [[email protected] mysql]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.16 Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Eric_029‘; Query OK, 0 rows affected (0.02 sec)
1 mysql> show databases; 2 +--------------------+ 3 | Database | 4 +--------------------+ 5 | information_schema | 6 | mysql | 7 | performance_schema | 8 | sys | 9 +--------------------+ 10 4 rows in set (0.00 sec) 11 12 mysql> show tables; 13 ERROR 1046 (3D000): No database selected 14 mysql> use mysql; 15 Reading table information for completion of table and column names 16 You can turn off this feature to get a quicker startup with -A 17 18 Database changed 19 mysql> show tables; 20 +---------------------------+ 21 | Tables_in_mysql | 22 +---------------------------+ 23 | columns_priv | 24 | component | 25 | db | 26 | default_roles | 27 | engine_cost | 28 | func | 29 | general_log | 30 | global_grants | 31 | gtid_executed | 32 | help_category | 33 | help_keyword | 34 | help_relation | 35 | help_topic | 36 | innodb_index_stats | 37 | innodb_table_stats | 38 | password_history | 39 | plugin | 40 | procs_priv | 41 | proxies_priv | 42 | role_edges | 43 | server_cost | 44 | servers | 45 | slave_master_info | 46 | slave_relay_log_info | 47 | slave_worker_info | 48 | slow_log | 49 | tables_priv | 50 | time_zone | 51 | time_zone_leap_second | 52 | time_zone_name | 53 | time_zone_transition | 54 | time_zone_transition_type | 55 | user | 56 +---------------------------+ 57 33 rows in set (0.00 sec)
MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone
Files or Resources | Location |
---|---|
Client programs and scripts | /usr/bin |
mysqld server | /usr/sbin |
Configuration file | /etc/my.cnf |
Data directory | /var/lib/mysql |
Error log file |
For RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log
For SLES: |
Value of secure_file_priv |
/var/lib/mysql-files |
System V init script |
For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld
For SLES: |
Systemd service |
For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld
For SLES: |
Pid file | /var/run/mysql/mysqld.pid |
Socket | /var/lib/mysql/mysql.sock |
Keyring directory | /var/lib/mysql-keyring |
Unix manual pages | /usr/share/man |
Include (header) files | /usr/include/mysql |
Libraries | /usr/lib/mysql |
Miscellaneous support files (for example, error messages, and character set files) |
/usr/share/mysql
|
原文地址:https://www.cnblogs.com/coreloving/p/10790391.html
时间: 2024-10-07 04:16:55