rpm -ivh MySQL-server各種報錯以及完整安裝說明

rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm報錯:

rpm-db-err.png

主要是因為CentOS本身自帶MariaDB沖突。

yum list | grep mysql然后yum remove mysql-libs刪掉已經(jīng)存在的依賴:

yum-remove.png

comp.png

再次執(zhí)行rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm:

err-autoconf.png

這是因為卻少autoconf庫: yum -y install autoconf

要初始化數(shù)據(jù)庫執(zhí)行命令:

  1. yum -y install autoconf: 自動加載mysql配置
  2. /usr/bin/mysql_install_db --user=mysql

如果不執(zhí)行/usr/bin/mysql_install_db --user=mysql:
錯誤: Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/hadoop100.pid).
less /var/lib/mysql/hadoop100.err:

200522 09:34:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2020-05-22 09:34:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-05-22 09:34:03 0 [Note] /usr/sbin/mysqld (mysqld 5.6.24) starting as process 79709 ...
2020-05-22 09:34:03 79709 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2020-05-22 09:34:03 79709 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2020-05-22 09:34:03 79709 [Note] InnoDB: Using atomics to ref count buffer pool pages
2020-05-22 09:34:03 79709 [Note] InnoDB: The InnoDB memory heap is disabled
2020-05-22 09:34:03 79709 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-05-22 09:34:03 79709 [Note] InnoDB: Memory barrier is not used
2020-05-22 09:34:03 79709 [Note] InnoDB: Compressed tables use zlib 1.2.3
2020-05-22 09:34:03 79709 [Note] InnoDB: Using Linux native AIO
2020-05-22 09:34:03 79709 [Note] InnoDB: Using CPU crc32 instructions
2020-05-22 09:34:03 79709 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2020-05-22 09:34:03 79709 [Note] InnoDB: Completed initialization of buffer pool
2020-05-22 09:34:03 79709 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2020-05-22 09:34:03 79709 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2020-05-22 09:34:03 79709 [Note] InnoDB: Database physically writes the file full: wait...
2020-05-22 09:34:03 79709 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2020-05-22 09:34:04 79709 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2020-05-22 09:34:04 79709 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2020-05-22 09:34:04 79709 [Warning] InnoDB: New log files created, LSN=45781
2020-05-22 09:34:04 79709 [Note] InnoDB: Doublewrite buffer not found: creating new
2020-05-22 09:34:04 79709 [Note] InnoDB: Doublewrite buffer created
2020-05-22 09:34:04 79709 [Note] InnoDB: 128 rollback segment(s) are active.
2020-05-22 09:34:04 79709 [Warning] InnoDB: Creating foreign key constraint system table

主要是/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist: 因為Table 'mysql.plugin' doesn't exist. 而mysql.plugin不存在的原因是, 新安裝的mysql服務后,一般需要執(zhí)行數(shù)據(jù)庫初始化操作 ,從而生成與權限相關的表,但是沒有,所以cat /root/.mysql_secret也沒有。

所以必須執(zhí)行 /usr/bin/mysql_install_db --user=mysql

最后再: service mysql start:

Starting MySQL. SUCCESS! 

此時如果cat /root/.mysql_secret有,那么就是隨機生成的密碼,如果沒有就是免密登錄。

然后rpm解壓MySQL-client就可以用了

/usr/bin/mysqladmin -u root password 123456設置密碼123456

事實上我在生產(chǎn)中從來不關服務器上的mysql, 不過一個月周五晚上DevOps檢查一次還是會關,設置mysql自啟動: chkconfig mysql on;

0, 1, 6是非正常啟動,所以這個inittab是對的;

on

ntsysv:查看kernel底層開機自啟動表, [*] mysql?:

ntsysv.png

mysql路徑:

路徑 內容
/var/lib/mysql mysql數(shù)據(jù)庫文件
/usr/share/mysql 配置文件
/usr/bin 相關命令
/etc/init.d/mysql 啟停腳本(sbin)

創(chuàng)建表如果出現(xiàn):ERROR 1044(42000): Access denied for user ''@'localhost' to database ‘mytestsql’, 是因為是從user登錄的不是root, user用戶只有usage權限沒有create權限

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容