環(huán)境:MySQL一主一從架構(gòu),主庫是mysql5.1,從庫是mysql5.6;系統(tǒng)均為CentOS6.2
目前創(chuàng)新互聯(lián)已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)頁空間、成都網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計(jì)、攀枝花網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
問題:
在主庫上面執(zhí)行的SQL語句
1.創(chuàng)建表
CREATE TABLE `app_versions` (
`date` date NOT NULL,
`app` char(16) NOT NULL,
`ver` char(16) NOT NULL,
`val` int(11) DEFAULT '0',
PRIMARY KEY (`date`,`app`,`ver`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
2.創(chuàng)建用戶并且給予權(quán)限
grant select on databasename.* to 'username'@'IPaddress' identified by 'password'
3.刷新權(quán)限信息
flush privileges
在主庫上面執(zhí)行完之后,在從庫上面執(zhí)行show slave status \G發(fā)現(xiàn)IO進(jìn)程和SQL進(jìn)程顯示的都是NO,然后執(zhí)行start slave IO_THREAD之后再次執(zhí)行show slave status \G 發(fā)現(xiàn)IO進(jìn)程是拉起來了的顯示的是YES,之后再執(zhí)行start slave SQL_THREAD進(jìn)程,show slave status \G發(fā)現(xiàn)IO進(jìn)程和SQL進(jìn)程都是顯示的NO,并且在從庫的錯(cuò)誤日志中可以獲取得到:
在錯(cuò)誤日志中可以很明顯的看得到日志提示:
Missing system table mysql.proxies_pri;please run mysql_upgrade to create it
日志提示系統(tǒng)表mysql.proxies_pri不存在,需要執(zhí)行mysql_upgrade,然后我自己google了一下,
發(fā)現(xiàn)大部分都是因?yàn)樯?jí)mysql之后沒有執(zhí)行mysql_upgrade導(dǎo)致的,但是我在主庫上面根本就沒有進(jìn)
行任何的升級(jí)操作,在從庫也是這個(gè)樣子,然后網(wǎng)上的建議是mysql_upgrade升級(jí)修復(fù)一下。
mysql_upgrade主要作用是檢測(cè)所有的表并且升級(jí)mysql這個(gè)系統(tǒng)庫內(nèi)所有的表,是進(jìn)行在線升級(jí)的,所以并不會(huì)影響線上操作(PS:當(dāng)然不包括有關(guān)mysql庫的操作)。
The mysql.proxies_priv
table contains information about proxy privileges. The table can be queried and although it is possible to directly update it, it is best to use GRANT for setting privileges.
可以看到上述對(duì)于mysql.proxies_priv系統(tǒng)表的猜測(cè),可以比較明顯的看到這個(gè)表主要是用來管理
數(shù)據(jù)庫用戶權(quán)限信息的表,所以我猜測(cè)數(shù)據(jù)庫很有可能卡在權(quán)限這塊了,并且在從庫中我在mysql.user這個(gè)表中并沒有發(fā)現(xiàn)我之前grant創(chuàng)建的用戶。這個(gè)時(shí)候我在從庫上面設(shè)置了跳過一個(gè)事務(wù):
set global sql_slave_skip_counter = 1(只是跳過一個(gè)事務(wù),跳過之后歸0)
之后我在重啟start slave。slave恢復(fù)了正常,日志也能夠正常的往里面寫了。所以我猜想這個(gè)問題和
權(quán)限有關(guān),假如需要驗(yàn)證的話,最好是在從庫上面開啟general log,并且在從庫的binlog獲取最新的事
務(wù)的信息并且根據(jù)獲取的信息在relay log中繼日志找到下一個(gè)事務(wù)是不是這個(gè)。
但是這個(gè)方案也是屬于治標(biāo)不治本,下次在執(zhí)行g(shù)rant操作的時(shí)候,可能還是會(huì)出現(xiàn)這個(gè)問題,所以還是最后使用mysql_upgrade
mysql_upgrade -uroot -p
[root@gitlab-test data]# mysql_upgrade -uroot -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
This installation of MySQL is already upgraded to 5.6.35, use --force if you still need to run mysql_upgrade
[root@gitlab-test data]# mysql_upgrade -uroot -p --force
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/data/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/data/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv_bak OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/data/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/data/mysql/mysql.sock'
Warning: Using a password on the command line interface can be insecure.
core_test.test OK
data_test.test OK
gitlabhq_production.abuse_reports OK
gitlabhq_production.application_settings OK
gitlabhq_production.audit_events OK
gitlabhq_production.broadcast_messages OK
gitlabhq_production.deploy_keys_projects OK
gitlabhq_production.emails OK
gitlabhq_production.events OK
gitlabhq_production.forked_project_links OK
gitlabhq_production.identities OK
gitlabhq_production.issues OK
gitlabhq_production.keys OK
gitlabhq_production.label_links OK
gitlabhq_production.labels OK
gitlabhq_production.members OK
gitlabhq_production.merge_request_diffs OK
gitlabhq_production.merge_requests OK
gitlabhq_production.milestones OK
gitlabhq_production.namespaces OK
gitlabhq_production.notes OK
gitlabhq_production.oauth_access_grants OK
gitlabhq_production.oauth_access_tokens OK
gitlabhq_production.oauth_applications OK
gitlabhq_production.project_import_data OK
gitlabhq_production.projects OK
gitlabhq_production.protected_branches OK
gitlabhq_production.schema_migrations OK
gitlabhq_production.services OK
gitlabhq_production.snippets OK
gitlabhq_production.subscriptions OK
gitlabhq_production.taggings OK
gitlabhq_production.tags OK
gitlabhq_production.users OK
gitlabhq_production.users_star_projects OK
gitlabhq_production.web_hooks OK
OK
當(dāng)前文章:mysql錯(cuò)誤【一】[ERROR]Missingsystemtablemysql.proxies_priv
文章起源:http://jinyejixie.com/article16/psipgg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、搜索引擎優(yōu)化、標(biāo)簽優(yōu)化、App開發(fā)、小程序開發(fā)、云服務(wù)器
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)