CentOS7安裝MySQL衝突和問題解決小結
原文:https://github.com/timespacegroup https://blog.csdn.net/typa01_kk/article/details/49059729
問題1:
[[email protected] install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm
Preparing... ################################# [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
……………………
解決1:
出現以上安裝錯誤列表的原因是:系統已經安裝了其他版本的mysql-libs包和mysql資料庫檔案導致不相容。
[[email protected] install-files]# yum remove mysql-libs
執行之後,還要詳細檢查解除安裝MySQL安裝的所有檔案,否則在後續安裝發生各種錯誤:CentOS下MySQL的徹底解除安裝
問題2:
[[email protected]_ts_tian developer]# rpm -ivh MySQL-server-5.5.46-1.el6.x86_64.rpm
warning: MySQL-server-5.5.46-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
解決2:
從 rpm版本 4.1 開始,在安裝或升級軟體包時會檢查軟體包的簽名。如果簽名校驗失敗,你就會看到類似以上的錯誤訊息:
注:新的、只針對檔案頭的簽名:錯誤訊息:error: Header V3 DSA signature: BAD, key ID 0352860f
注:沒有安裝合適的鑰匙來校驗簽名,訊息中就會包含 NOKEY:錯誤訊息:warning: V3 DSA signature: NOKEY, key ID 0352860f
由於yum安裝了舊版本的GPG keys造成的,解決辦法就是(設定後無效):
rpm --import /etc/pki/rpm-gpg/RPM*
此簽名是檢驗安裝包的有效性和安裝性的。我直接跳過(安裝時不校驗,加--nosignature引數)檢驗安裝:
[[email protected] install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
問題3:
mysqld: unrecognized service
-
[[email protected]_ts_tian init.d]# service mysqld start
-
mysqld: unrecognized service
解決3:
啟動指令碼檔案mysql的目錄
-
[[email protected] install-files]# cd /etc/rc.d/init.d/
-
[[email protected] init.d]# ls
-
functions mysql netconsole network README
並沒有mysqld:
[[email protected]_ts_tian init.d]# service mysql start
啟動成功:
也可以:
-
[[email protected]_ts_tian init.d]# mv mysql mysqld
-
[[email protected]_ts_tian init.d]# service mysqld start
問題4:
[[email protected] install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-server-5.6.27-1.el6 ################################# [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper
解決4:
[[email protected] install-files]# yum install -y perl-Module-Install.noarch
問題5:
[[email protected] mysql]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
-
[[email protected] init.d]# cd /var/lib/mysql/
-
[[email protected] mysql]# ll
-
total 110620
-
-rw-rw----. 1 mysql mysql 56 Oct 11 23:20 auto.cnf
-
-rw-rw----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1
-
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0
-
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1
-
-rw-r-----. 1 mysql root 5847 Oct 11 23:20 localhost.localdomain.err
-
drwx--x--x. 2 mysql mysql 4096 Oct 11 23:19 mysql
-
drwx------. 2 mysql mysql 4096 Oct 11 23:19 performance_schema
-
-rw-r--r--. 1 root root 111 Oct 11 23:19 RPM_UPGRADE_HISTORY
-
-rw-r--r--. 1 mysql mysql 111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST
-
drwxr-xr-x. 2 mysql mysql 6 Oct 11 23:19 test
檢視路徑:mysql-bin.index多餘檔案,auto.cnf和performance_schema等不存在(檔案不全)。(以上為成功後的mysql資料庫目錄)
解決5:
因為以前存在的MySQL解除安裝不乾淨導致。
-
[[email protected] mysql]# rpm -aq | grep -i mysql
-
MySQL-server-5.6.27-1.el6.x86_64
-
MySQL-client-5.6.27-1.el6.x86_64
-
MySQL-devel-5.6.27-1.el6.x86_64
-
[[email protected] mysql]# rpm -e MySQL-server-5.6.27-1.el6.x86_64
-
[[email protected] mysql]# rpm -e MySQL-client-5.6.27-1.el6.x86_64
-
[[email protected] mysql]# rpm -e MySQL-devel-5.6.27-1.el6.x86_64
-
[[email protected] rc.d]# cd /var/lib/
-
[[email protected] lib]# rm -rf mysql/
-
[[email protected] install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
-
Preparing... ################################# [100%]
-
Updating / installing...
-
1:MySQL-server-5.6.27-1.el6 ################################# [100%]
-
2015-10-11 23:19:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-
2015-10-11 23:19:40 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 3168 ...
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Using atomics to ref count buffer pool pages
-
2015-10-11 23:19:40 3168 [Note] InnoDB: The InnoDB memory heap is disabled
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Memory barrier is not used
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Compressed tables use zlib 1.2.3
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Using Linux native AIO
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Using CPU crc32 instructions
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Completed initialization of buffer pool
-
2015-10-11 23:19:40 3168 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Database physically writes the file full: wait...
-
2015-10-11 23:19:40 3168 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
-
2015-10-11 23:19:41 3168 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
-
2015-10-11 23:19:43 3168 [Warning] InnoDB: New log files created, LSN=45781
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Doublewrite buffer not found: creating new
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Doublewrite buffer created
-
2015-10-11 23:19:43 3168 [Note] InnoDB: 128 rollback segment(s) are active.
-
2015-10-11 23:19:43 3168 [Warning] InnoDB: Creating foreign key constraint system tables.
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Foreign key constraint system tables created
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Creating tablespace and datafile system tables.
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Tablespace and datafile system tables created.
-
2015-10-11 23:19:43 3168 [Note] InnoDB: Waiting for purge to start
-
2015-10-11 23:19:43 3168 [Note] InnoDB: 5.6.27 started; log sequence number 0
-
A random root password has been set. You will find it in '/root/.mysql_secret'.
-
2015-10-11 23:19:44 3168 [Note] Binlog end
-
2015-10-11 23:19:44 3168 [Note] InnoDB: FTS optimize thread exiting.
-
2015-10-11 23:19:44 3168 [Note] InnoDB: Starting shutdown...
-
2015-10-11 23:19:46 3168 [Note] InnoDB: Shutdown completed; log sequence number 1625977
-
2015-10-11 23:19:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-
2015-10-11 23:19:46 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 3190 ...
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Using atomics to ref count buffer pool pages
-
2015-10-11 23:19:46 3190 [Note] InnoDB: The InnoDB memory heap is disabled
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Memory barrier is not used
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Compressed tables use zlib 1.2.3
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Using Linux native AIO
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Using CPU crc32 instructions
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Initializing buffer pool, size = 128.0M
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Completed initialization of buffer pool
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Highest supported file format is Barracuda.
-
2015-10-11 23:19:46 3190 [Note] InnoDB: 128 rollback segment(s) are active.
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Waiting for purge to start
-
2015-10-11 23:19:46 3190 [Note] InnoDB: 5.6.27 started; log sequence number 1625977
-
2015-10-11 23:19:46 3190 [Note] Binlog end
-
2015-10-11 23:19:46 3190 [Note] InnoDB: FTS optimize thread exiting.
-
2015-10-11 23:19:46 3190 [Note] InnoDB: Starting shutdown...
-
2015-10-11 23:19:49 3190 [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
檢查:
-
[[email protected] install-files]# service mysql start
-
Starting MySQL.. SUCCESS!
-
[[email protected] install-files]# service mysql stop
-
Shutting down MySQL.. SUCCESS!
-
[[email protected] mysql]# ll
-
total 110620
-
-rw-rw----. 1 mysql mysql 56 Oct 11 23:20 auto.cnf
-
-rw-rw----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1
-
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0
-
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1
-
-rw-r-----. 1 mysql root 5847 Oct 11 23:20 localhost.localdomain.err
-
drwx--x--x. 2 mysql mysql 4096 Oct 11 23:19 mysql
-
drwx------. 2 mysql mysql 4096 Oct 11 23:19 performance_schema
-
-rw-r--r--. 1 root root 111 Oct 11 23:19 RPM_UPGRADE_HISTORY
-
-rw-r--r--. 1 mysql mysql 111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST
-
drwxr-xr-x. 2 mysql mysql 6 Oct 11 23:19 test
設定後,也可以:mysql -u root -p;進行登入測試。
成功的安裝,日誌中顯示(建立兩個檔案):
A random root password has been set. You will find it in '/root/.mysql_secret'.
New default config file was created as /usr/my.cnf andwill be used by default by the server when you start it.