星期二, 6月 05, 2018

CentOS 7 安裝MySQL 5.6 rpm遇到mariadb-libs is obsoleted by MySQL-shared-compat-advanced訊息

#前置作業 : 安裝CentOS with Server GUI option
#掛載cdrom
mount -t iso9660 /dev/sr0 /mnt
cd /etc/yum.repos.d
cp local.repo CentOS-Base.repo

#建立local yum server
local.repo:
--------------------------
[local]
name=local
gpgcheck=0
baseurl=file:///mnt
--------------------------

[root@centos7 mysql5.6.40]# ls
MySQL-client-advanced-5.6.40-1.el7.x86_64.rpm    MySQL-shared-advanced-5.6.40-1.el7.x86_64.rpm
MySQL-devel-advanced-5.6.40-1.el7.x86_64.rpm     MySQL-shared-compat-advanced-5.6.40-1.el7.x86_64.rpm
MySQL-embedded-advanced-5.6.40-1.el7.x86_64.rpm  MySQL-test-advanced-5.6.40-1.el7.x86_64.rpm
MySQL-server-advanced-5.6.40-1.el7.x86_64.rpm    README.txt

[root@centos7 mysql5.6.40]# yum list
[root@centos7 mysql5.6.40]# rpm -ivh *.rpm
warning: MySQL-client-advanced-5.6.40-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        mariadb-libs is obsoleted by MySQL-shared-compat-advanced-5.6.40-1.el7.x86_64
[root@centos7 mysql5.6.40]# rpm -ivh *.rpm
warning: MySQL-client-advanced-5.6.40-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        mariadb-libs is obsoleted by MySQL-shared-compat-advanced-5.6.40-1.el7.x86_64

[root@centos7 mysql5.6.40]# yum list |grep mariadb
mariadb-libs.x86_64                     1:5.5.56-2.el7                 @anaconda
mariadb.x86_64                          1:5.5.56-2.el7                 local   
mariadb-bench.x86_64                    1:5.5.56-2.el7                 local   
mariadb-devel.x86_64                    1:5.5.56-2.el7                 local   
mariadb-server.x86_64                   1:5.5.56-2.el7                 local   
mariadb-test.x86_64                     1:5.5.56-2.el7                 local

#查了以下link, 只要使用yum remove指令來反安裝centos 7 內帶的mariadb套件即可
#ref: https://www.percona.com/forums/questions-discussions/mysql-and-percona-server/percona-server-5-7/50843-centos-7-4-1708-install-problem
[root@centos7 mysql5.6.40]# yum remove mariadb-libs

[root@centos7 mysql5.6.40]# rpm -ivh *.rpm
warning: MySQL-client-advanced-5.6.40-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-devel-advanced-5.6.40-1.el7################################# [ 14%]
   2:MySQL-client-advanced-5.6.40-1.el################################# [ 29%]
   3:MySQL-test-advanced-5.6.40-1.el7 ################################# [ 43%]
   4:MySQL-embedded-advanced-5.6.40-1.################################# [ 57%]
   5:MySQL-shared-compat-advanced-5.6.################################# [ 71%]
   6:MySQL-shared-advanced-5.6.40-1.el################################# [ 86%]
^[[B   7:MySQL-server-advanced-5.6.40-1.el################################# [100%]
2018-06-05 11:59:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults
_for_timestamp server option (see documentation for more details).
2018-06-05 11:59:16 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-06-05 11:59:16 0 [Note] /usr/sbin/mysqld (mysqld 5.6.40-enterprise-commercial-advanced) starting as process 17
677 ...
2018-06-05 11:59:16 17677 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-06-05 11:59:16 17677 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-05 11:59:16 17677 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-05 11:59:16 17677 [Note] InnoDB: Memory barrier is not used
2018-06-05 11:59:16 17677 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-05 11:59:16 17677 [Note] InnoDB: Using Linux native AIO
2018-06-05 11:59:16 17677 [Note] InnoDB: Using CPU crc32 instructions
2018-06-05 11:59:16 17677 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-05 11:59:16 17677 [Note] InnoDB: Completed initialization of buffer pool
2018-06-05 11:59:16 17677 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to b
e created!
2018-06-05 11:59:16 17677 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-06-05 11:59:16 17677 [Note] InnoDB: Database physically writes the file full: wait...
2018-06-05 11:59:16 17677 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-06-05 11:59:16 17677 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-06-05 11:59:16 17677 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-06-05 11:59:16 17677 [Warning] InnoDB: New log files created, LSN=45781
2018-06-05 11:59:16 17677 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-06-05 11:59:16 17677 [Note] InnoDB: Doublewrite buffer created
2018-06-05 11:59:16 17677 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-05 11:59:16 17677 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-06-05 11:59:16 17677 [Note] InnoDB: Foreign key constraint system tables created
2018-06-05 11:59:16 17677 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-06-05 11:59:16 17677 [Note] InnoDB: Tablespace and datafile system tables created.
2018-06-05 11:59:16 17677 [Note] InnoDB: Waiting for purge to start
2018-06-05 11:59:16 17677 [Note] InnoDB: 5.6.40 started; log sequence number 0
2018-06-05 11:59:16 17677 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authenticati
on plugins will not work.
2018-06-05 11:59:16 17677 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication
plugins will not work.
A random root password has been set. You will find it in '/root/.mysql_secret'.
2018-06-05 11:59:16 17677 [Note] Binlog end
2018-06-05 11:59:16 17677 [Note] InnoDB: FTS optimize thread exiting.
2018-06-05 11:59:16 17677 [Note] InnoDB: Starting shutdown...
2018-06-05 11:59:18 17677 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2018-06-05 11:59:18 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults
_for_timestamp server option (see documentation for more details).
2018-06-05 11:59:18 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-06-05 11:59:18 0 [Note] /usr/sbin/mysqld (mysqld 5.6.40-enterprise-commercial-advanced) starting as process 17
699 ...
2018-06-05 11:59:18 17699 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-06-05 11:59:18 17699 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-05 11:59:18 17699 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-05 11:59:18 17699 [Note] InnoDB: Memory barrier is not used
2018-06-05 11:59:18 17699 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-05 11:59:18 17699 [Note] InnoDB: Using Linux native AIO
2018-06-05 11:59:18 17699 [Note] InnoDB: Using CPU crc32 instructions
2018-06-05 11:59:18 17699 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-05 11:59:18 17699 [Note] InnoDB: Completed initialization of buffer pool
2018-06-05 11:59:18 17699 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-05 11:59:18 17699 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-05 11:59:18 17699 [Note] InnoDB: Waiting for purge to start
2018-06-05 11:59:18 17699 [Note] InnoDB: 5.6.40 started; log sequence number 1625977
2018-06-05 11:59:18 17699 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authenticati
on plugins will not work.
2018-06-05 11:59:18 17699 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication
plugins will not work.
2018-06-05 11:59:18 17699 [Note] Binlog end
2018-06-05 11:59:18 17699 [Note] InnoDB: FTS optimize thread exiting.
2018-06-05 11:59:18 17699 [Note] InnoDB: Starting shutdown...
2018-06-05 11:59:20 17699 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[root@centos7 mysql5.6.40]#

[root@centos7 ~]# service mysql start
Starting MySQL.Logging to '/var/lib/mysql/centos7.err'.
 SUCCESS! 

[root@centos7 ~]# cat /root/.mysql_secret
# The random password set for the root user at Tue Jun  5 11:59:16 2018 (local time): _kfexRNHgd7Oeqqv

[root@centos7 ~]# service mysql status
 SUCCESS! MySQL running (19121)
[root@centos7 ~]#  /usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[root@centos7 ~]#

#列出所有rich-rules
[root@centos7 usr]# firewall-cmd --zone=public --list-rich-rules

[root@centos7 usr]#
[root@centos7 usr]# firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.2.0/24"
port port="3306" protocol="tcp" accept' --permanent
success
[root@centos7 usr]# firewall-cmd --zone=public --list-rich-rules

[root@centos7 usr]# service firewalld restart
Redirecting to /bin/systemctl restart firewalld.service
[root@centos7 usr]# firewall-cmd --zone=public --list-rich-rules
rule family="ipv4" source address="192.168.2.0/24" port port="3306" protocol="tcp" accept
[root@centos7 usr]#

#去任一台主機測試mysql 的3306 port是否已經於防火牆開通了
[root@centos7 usr]# telnet 192.168.2.xxx
F Host '192.168.2.1' is not allowed to connect to this MySQL server

ref:
https://n.sfs.tw/content/index/10384

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...