CentOS7安裝MySQL沖突和問題解決小結


 
問題1:
[root@localhost 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數據庫文件導致不兼容。
[root@localhost install-files]# yum remove mysql-libs
 
執行之后,還要詳細檢查卸載MySQL安裝的所有文件,否則在后續安裝發生各種錯誤: CentOS下MySQL的徹底卸載
問題2:
[root@Tony_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參數)檢驗安裝:
[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
 
問題3:
mysqld: unrecognized service
  1.  
    [root@Tony_ts_tian init.d] # service mysqld start
  2.  
    mysqld: unrecognized service
解決3:
啟動腳本文件mysql的目錄
  1.  
    [root@localhost install-files] # cd /etc/rc.d/init.d/
  2.  
    [root@localhost init.d] # ls
  3.  
    functions mysql netconsole network README
並沒有mysqld:
[root@Tony_ts_tian init.d]# service mysql start
 
啟動成功:
也可以:
  1.  
    [root@Tony_ts_tian init.d] # mv mysql mysqld
  2.  
    [root@Tony_ts_tian init.d] # service mysqld start
問題4:
[root@localhost 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:
[root@localhost install-files]# yum install -y perl-Module-Install.noarch
 
問題5:
[root@localhost mysql]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
  1.  
    [root@localhost init.d]# cd /var/lib/mysql/
  2.  
    [root@localhost mysql]# ll
  3.  
    total 110620
  4.  
    -rw-rw----. 1 mysql mysql 56 Oct 11 23: 20 auto.cnf
  5.  
    -rw-rw----. 1 mysql mysql 12582912 Oct 11 23: 20 ibdata1
  6.  
    -rw-rw----. 1 mysql mysql 50331648 Oct 11 23: 20 ib_logfile0
  7.  
    -rw-rw----. 1 mysql mysql 50331648 Oct 11 23: 19 ib_logfile1
  8.  
    -rw-r-----. 1 mysql root 5847 Oct 11 23: 20 localhost.localdomain. err
  9.  
    drwx--x--x. 2 mysql mysql 4096 Oct 11 23: 19 mysql
  10.  
    drwx------. 2 mysql mysql 4096 Oct 11 23: 19 performance_schema
  11.  
    -rw-r--r--. 1 root root 111 Oct 11 23: 19 RPM_UPGRADE_HISTORY
  12.  
    -rw-r--r--. 1 mysql mysql 111 Oct 11 23: 19 RPM_UPGRADE_MARKER-LAST
  13.  
    drwxr-xr-x. 2 mysql mysql 6 Oct 11 23: 19 test
查看路徑:mysql-bin.index多余文件,auto.cnf和performance_schema等不存在(文件不全)。(以上為成功后的mysql數據庫目錄)
解決5:
因為以前存在的MySQL卸載不干凈導致。
刪除和卸載(以下是的解決),然后重新安裝: CentOS下MySQL的徹底卸載
  1.  
    [ root@localhost mysql] # rpm -aq | grep -i mysql
  2.  
    MySQL-server -5.6 .27 -1.el6.x86_64
  3.  
    MySQL-client -5.6 .27 -1.el6.x86_64
  4.  
    MySQL-devel -5.6 .27 -1.el6.x86_64
  5.  
    [ root@localhost mysql] # rpm -e MySQL-server-5.6.27-1.el6.x86_64
  6.  
    [ root@localhost mysql] # rpm -e MySQL-client-5.6.27-1.el6.x86_64
  7.  
    [ root@localhost mysql] # rpm -e MySQL-devel-5.6.27-1.el6.x86_64
  8.  
    [ root@localhost rc.d] # cd /var/lib/
  9.  
    [ root@localhost lib] # rm -rf mysql/
  10.  
    [ root@localhost install-files] # rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
  11.  
    Preparing... ################################# [100%]
  12.  
    Updating / installing...
  13.  
    1:MySQL-server -5.6 .27 -1.el6 ################################# [100%]
  14.  
    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).
  15.  
    2015-10-11 23:19:40 0 [Note] /usr/sbin/ mysqld ( mysqld 5.6.27 ) starting as process 3168 ...
  16.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Using atomics to ref count buffer pool pages
  17.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: The InnoDB memory heap is disabled
  18.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  19.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Memory barrier is not used
  20.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Compressed tables use zlib 1.2.3
  21.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Using Linux native AIO
  22.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Using CPU crc32 instructions
  23.  
    2015-10-11 23:19:40 3168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  24.  
    2015 -10 -11 23: 19: 40 3168 [Note] InnoDB: Completed initialization of buffer pool
  25.  
    2015 -10 -11 23: 19: 40 3168 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
  26.  
    2015 -10 -11 23: 19: 40 3168 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
  27.  
    2015 -10 -11 23: 19: 40 3168 [Note] InnoDB: Database physically writes the file full: wait...
  28.  
    2015 -10 -11 23: 19: 40 3168 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
  29.  
    2015 -10 -11 23: 19: 41 3168 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
  30.  
    2015 -10 -11 23: 19: 43 3168 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  31.  
    2015 -10 -11 23: 19: 43 3168 [Warning] InnoDB: New log files created, LSN= 45781
  32.  
    2015 -10 -11 23: 19: 43 3168 [Note] InnoDB: Doublewrite buffer not found: creating new
  33.  
    2015 -10 -11 23: 19: 43 3168 [Note] InnoDB: Doublewrite buffer created
  34.  
    2015 -10 -11 23: 19: 43 3168 [Note] InnoDB: 128 rollback segment(s) are active.
  35.  
    2015-10-11 23:19:43 3168 [Warning] InnoDB: Creating foreign key constraint system tables.
  36.  
    2015-10-11 23:19:43 3168 [Note] InnoDB: Foreign key constraint system tables created
  37.  
    2015-10-11 23:19:43 3168 [Note] InnoDB: Creating tablespace and datafile system tables.
  38.  
    2015-10-11 23:19:43 3168 [Note] InnoDB: Tablespace and datafile system tables created.
  39.  
    2015-10-11 23:19:43 3168 [Note] InnoDB: Waiting for purge to start
  40.  
    2015-10-11 23:19:43 3168 [Note] InnoDB: 5.6.27 started; log sequence number 0
  41.  
    A random root password has been set. You will find it in '/root/.mysql_secret'.
  42.  
    2015 -10 -11 23: 19: 44 3168 [Note] Binlog end
  43.  
    2015 -10 -11 23: 19: 44 3168 [Note] InnoDB: FTS optimize thread exiting.
  44.  
    2015 -10 -11 23: 19: 44 3168 [Note] InnoDB: Starting shutdown...
  45.  
    2015 -10 -11 23: 19: 46 3168 [Note] InnoDB: Shutdown completed; log sequence number 1625977
  46.  
     
  47.  
    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).
  48.  
    2015-10-11 23:19:46 0 [Note] /usr/sbin/ mysqld ( mysqld 5.6.27 ) starting as process 3190 ...
  49.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Using atomics to ref count buffer pool pages
  50.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: The InnoDB memory heap is disabled
  51.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  52.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Memory barrier is not used
  53.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Compressed tables use zlib 1.2.3
  54.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Using Linux native AIO
  55.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Using CPU crc32 instructions
  56.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  57.  
    2015 -10 -11 23: 19: 46 3190 [Note] InnoDB: Completed initialization of buffer pool
  58.  
    2015 -10 -11 23: 19: 46 3190 [Note] InnoDB: Highest supported file format is Barracuda.
  59.  
    2015 -10 -11 23: 19: 46 3190 [Note] InnoDB: 128 rollback segment(s) are active.
  60.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: Waiting for purge to start
  61.  
    2015-10-11 23:19:46 3190 [Note] InnoDB: 5.6.27 started; log sequence number 1625977
  62.  
    2015 -10 -11 23: 19: 46 3190 [Note] Binlog end
  63.  
    2015 -10 -11 23: 19: 46 3190 [Note] InnoDB: FTS optimize thread exiting.
  64.  
    2015 -10 -11 23: 19: 46 3190 [Note] InnoDB: Starting shutdown...
  65.  
    2015 -10 -11 23: 19: 49 3190 [Note] InnoDB: Shutdown completed; log sequence number 1625987
  66.  
     
  67.  
    A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
  68.  
    You will find that password in '/root/.mysql_secret'.
  69.  
     
  70.  
    You must change that password on your first connect,
  71.  
    no other statement but 'SET PASSWORD' will be accepted.
  72.  
    See the manual for the semantics of the 'password expired' flag.
  73.  
     
  74.  
    Also, the account for the anonymous user has been removed.
  75.  
     
  76.  
    In addition, you can run:
  77.  
     
  78.  
    /usr/bin/mysql_secure_installation
  79.  
     
  80.  
    which will also give you the option of removing the test database.
  81.  
    This is strongly recommended for production servers.
  82.  
     
  83.  
    See the manual for more instructions.
  84.  
     
  85.  
    Please report any problems at http: //bugs.mysql.com/
  86.  
     
  87.  
    The latest information about MySQL is available on the web at
  88.  
     
  89.  
    http: //www.mysql.com
  90.  
     
  91.  
    Support MySQL by buying support/licenses at http: //shop.mysql.com
  92.  
     
  93.  
    New default config file was created as /usr/my.cnf and
  94.  
    will be used by default by the server when you start it.
  95.  
    You may edit this file to change server settings
 
檢查:
  1.  
    [root@localhost install-files]# service mysql start
  2.  
    Starting MySQL.. SUCCESS!
  3.  
    [root@localhost install-files]# service mysql stop
  4.  
    Shutting down MySQL.. SUCCESS!
  5.  
    [root@localhost mysql]# ll
  6.  
    total 110620
  7.  
    -rw-rw ----. 1 mysql mysql 56 Oct 11 23:20 auto.cnf
  8.  
    -rw-rw ----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1
  9.  
    -rw-rw ----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0
  10.  
    -rw-rw ----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1
  11.  
    -rw-r -----. 1 mysql root 5847 Oct 11 23:20 localhost.localdomain.err
  12.  
    drwx --x--x. 2 mysql mysql 4096 Oct 11 23:19 mysql
  13.  
    drwx ------. 2 mysql mysql 4096 Oct 11 23:19 performance_schema
  14.  
    -rw-r --r--. 1 root root 111 Oct 11 23:19 RPM_UPGRADE_HISTORY
  15.  
    -rw-r --r--. 1 mysql mysql 111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST
  16.  
    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.

原文連接:https://blog.csdn.net/typa01_kk/article/details/49059729 

支持原創,侵權聯系刪除:763893274


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM