【mysql】配置MySQL,解決安裝過程中的問題

00潤物無聲00發表於2017-08-16

在文章,Centos6.2中mysql的安裝與配置中,使用yum的方式安裝了mysql 。再次安裝的時候跟系統的環境有關係,遇到了不少問題。記錄一下。


  yum 安裝 出錯 Error: Protected multilib versions:

    

  file /usr/share/man/man1/mysqlshow.1.gz from install of mysql-5.1.73-8.el6_8.x86_64 conflicts with   file from package MySQL-client-5.5.48-1.linux2.6.i386
  file /usr/share/man/man1/mysqlslap.1.gz from install of mysql-5.1.73-8.el6_8.x86_64 conflicts with   file from package MySQL-client-5.5.48-1.linux2.6.i386

  解決方案:rpm -e mysql-server-5.1.73-8.el6_8.x86_64 --nodeps


  170721 22:25:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
  170721 22:25:03 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
  170721 22:25:03  InnoDB: Initializing buffer pool, size = 8.0M
  170721 22:25:03  InnoDB: Completed initialization of buffer pool
  InnoDB: The log sequence number in ibdata files does not match
  InnoDB: the log sequence number in the ib_logfiles!
  170721 22:25:03  InnoDB: Database was not shut down normally!
  InnoDB: Starting crash recovery.
  InnoDB: Reading tablespace information from the .ibd files...
  InnoDB: Restoring possible half-written data pages from the doublewrite
  InnoDB: buffer...
  170721 22:25:03  InnoDB: Started; log sequence number 0 1595675
  170721 22:25:03 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
  170721 22:25:03 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
  170721 22:25:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
170721 22:25:24 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
  170721 22:25:24  InnoDB: Initializing buffer pool, size = 8.0M
  170721 22:25:24  InnoDB: Completed initialization of buffer pool
  InnoDB: The log sequence number in ibdata files does not match
  InnoDB: the log sequence number in the ib_logfiles!
  170721 22:25:24  InnoDB: Database was not shut down normally!
  InnoDB: Starting crash recovery.
  InnoDB: Reading tablespace information from the .ibd files...
  InnoDB: Restoring possible half-written data pages from the doublewrite
  InnoDB: buffer...
  170721 22:25:24  InnoDB: Started; log sequence number 0 1595675
  170721 22:25:24 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
  170721 22:25:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
  170721 22:25:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
  /usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
170721 22:25:37 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

  安裝完啟動的時候遇到上述問題。

  解決方案:rm -rf /var/lib/mysql


 登陸mysql

  [root@root opt]# mysql -u root password fxq123
  mysqladmin: connect to server at 'localhost' failed
  error: 'Access denied for user 'root'@'localhost' (using password: NO)'

  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  解決方案:使用mysql -uroot -proot
 一旦登入之後,可以修改使用者的賬號和密碼,

  檢視使用者授權表:select user,host,password from mysql.user;

  給使用者設定密碼:update mysql.user set password=PASSWORD('root') where user='root';

             flush privileges;

相關文章