mysql connection issue
https://stackoverflow.com/questions/40561433/docker-mysql-2002-connection-refused
connection refused means connected but refused access
if mysql is run by docker
access in two ways, same host, web app acces, for hostname use docker compose services name:
AKA db
docker-compose ps can tell you servie name
for mysql bench,
pick ssh option with credential first
then host use 127.0.0.1 or serivce name then credential
root user by default is local host
https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost
createa a user in mysql grant permission in a table:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql
https://www.atlassian.com/data/admin/how-to-grant-all-privileges-on-a-database-in-mysql#:~:text=To%20GRANT%20ALL%20privileges%20to,GRANT%20ALL%20PRIVILEGES%20ON%20database_name.
CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password';
@ '%' means everywhere access
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';
No comments:
Post a Comment