github / gh-ost

GitHub's Online Schema-migration Tool for MySQL
MIT License
12.11k stars 1.23k forks source link

Cannot log in to mysql DB by ghost user #1416

Open PaulChen79 opened 1 month ago

PaulChen79 commented 1 month ago

I'm using gh-ost on my local environment to test if my migration is work.

My master-slave setting is

127.0.0.1:3307 -> master by docker image 127.0.0.1:3308 -> slave by docker image

I've created an user 'ghost'@'%' on master and logging in by this account is tested by command line below:

mysql -h 127.0.0.1 --port=3307 -ughost -p # for master works!
mysql -h 127.0.0.1 --port=3308 -ughost -p # for slave works!

Now when I execute this command

gh-ost \
--user="ghost" \
--password="ghost" \
--host="127.0.0.1" \
--serve-tcp-port=3307 \
--max-load=Threads_running=100 \
--critical-load=Threads_running=1000 \
--chunk-size=2000 \
--throttle-control-replicas="127.0.0.1:3308" \
--replica-server-id='2' \
--max-lag-millis=1000 \
--nice-ratio=12 \
--allow-on-master \
--database="test-db" \
--table="test_table" \
--verbose \
--alter="ADD action_item_id int(10) unsigned NOT NULL DEFAULT 0" \
--switch-to-rbr \
--allow-master-master \
--cut-over=default \
--exact-rowcount \
--concurrent-rowcount \
--default-retries=120 \
--panic-flag-file=/<path>/ghost-file/co_ghost.panic.flag \
--throttle-flag-file=/<path>/ghost-file/co_ghost.throttle.flag \
--postpone-cut-over-flag-file=/<path>/ghost-file/co_ghost.postpone.flag \
--execute

I encounter this error:

2024-05-10 14:39:55 INFO starting gh-ost 1.1.6
2024-05-10 14:39:55 INFO Migrating `test-db`.`test_table`
2024-05-10 14:39:55 INFO Tearing down inspector
2024-05-10 14:39:55 FATAL Error 1045: Access denied for user 'ghost'@'localhost' (using password: YES)

I don't know how to resolve this issue because currently, I believe my host and port settings are correct. Or are my settings incorrect?

Thank you! 🙏