Self-Hosted V2 Getting Error: Access denied for user 'std_notes_user'
I'm trying to set up a self-hosted Standard Notes instance, but keep getting this access denied error. (Well, I'm actually trying to do a migration from a legacy self-hosted install, but I scrapped everything and started from scratch as a test, and am still getting this error.)
I followed the steps exactly:
- Starting in an empty directory.
-
touch .env curl https://raw.githubusercontent.com/standardnotes/server/main/.env.sample > .env - Set values in
KEYSsection using values generated byopenssl rand -hex 32. -
curl https://raw.githubusercontent.com/standardnotes/server/main/docker/localstack_bootstrap.sh > localstack_bootstrap.sh chmod +x localstack_bootstrap.sh -
curl https://raw.githubusercontent.com/standardnotes/server/main/docker-compose.example.yml > docker-compose.yml - Generate DB password with
openssl rand -hex 12, save toDB_PASSWORDin.envand bothMYSQL_ROOT_PASSWORDandMYSQL_PASSWORDindocker-compose.yml. - (I had to add e.g.
version: '3.5'to mydocker-compose.yml, possibly because I'm on an old version of Compose.) -
docker-compose pullanddocker-compose up.
On docker-compose up, services begin starting up and it runs for a bit, but then eventually starts looping on messages like this:
server_self_hosted | 2024-02-23 03:27:15,028 WARN exited: revisions (exit status 1; not expected)
db_self_hosted | 2024-02-23T03:27:15.197167Z 9 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
server_self_hosted | 2024-02-23 03:27:15,247 INFO spawned: 'revisions' with pid 210
server_self_hosted | 2024-02-23 03:27:15,721 WARN exited: syncing-server-worker (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:15,777 INFO spawned: 'syncing-server-worker' with pid 227
server_self_hosted | 2024-02-23 03:27:16,300 INFO success: revisions entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
server_self_hosted | 2024-02-23 03:27:16,788 INFO success: syncing-server-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
server_self_hosted | 2024-02-23 03:27:16,788 WARN exited: auth (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:16,802 INFO spawned: 'auth' with pid 243
server_self_hosted | 2024-02-23 03:27:17,835 INFO success: auth entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
db_self_hosted | 2024-02-23T03:27:23.836363Z 10 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
server_self_hosted | 2024-02-23 03:27:24,743 WARN exited: syncing-server-worker (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:24,746 INFO spawned: 'syncing-server-worker' with pid 270
server_self_hosted | 2024-02-23 03:27:25,745 INFO success: syncing-server-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
server_self_hosted | 2024-02-23 03:27:27,086 WARN exited: auth (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:27,114 INFO spawned: 'auth' with pid 286
server_self_hosted | 2024-02-23 03:27:28,126 INFO success: auth entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
server_self_hosted | 2024-02-23 03:27:32,279 WARN exited: syncing-server-worker (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:32,288 INFO spawned: 'syncing-server-worker' with pid 306
server_self_hosted | 2024-02-23 03:27:33,326 INFO success: syncing-server-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
server_self_hosted | 2024-02-23 03:27:35,385 WARN exited: auth (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:35,439 INFO spawned: 'auth' with pid 322
server_self_hosted | 2024-02-23 03:27:36,470 INFO success: auth entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
db_self_hosted | 2024-02-23T03:27:39.531700Z 11 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
db_self_hosted | 2024-02-23T03:27:43.213380Z 12 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
server_self_hosted | 2024-02-23 03:27:59,863 WARN exited: auth-worker (exit status 1; not expected)
server_self_hosted | 2024-02-23 03:27:59,871 INFO spawned: 'auth-worker' with pid 388
server_self_hosted | 2024-02-23 03:28:00,897 INFO success: auth-worker entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Okay, a couple services keep dying, let me look at the logs. Picking one at random, auth.err, I see this message looping:
localhost (127.0.0.1:3101) open
/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/packets/packet.js:728
const err = new Error(message);
^
Error: Access denied for user 'std_notes_user'@'172.26.0.9' (using password: YES)
at Packet.asError (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/packets/packet.js:728:17)
at ClientHandshake.execute (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/connection.js:490:32)
at PacketParser.onPacket (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/connection.js:95:12)
at PacketParser.executeStart (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket.<anonymous> (/opt/server/.yarn/cache/mysql2-npm-3.3.3-d2fe8cf512-4bf7ace8f1.zip/node_modules/mysql2/lib/connection.js:102:25)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:545:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:495:3)
at Readable.push (node:internal/streams/readable:375:5) {
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '28000',
sqlMessage: "Access denied for user 'std_notes_user'@'172.26.0.9' (using password: YES)",
sql: undefined
}
Node.js v20.10.0
This doesn't make sense, because I've double-triple-checked that DB_PASSWORD matches MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD, so it can't be the same problem as #507.
I even verified that the database password was set correctly, by connecting to the DB container:
docker-compose exec db sh
then connecting to MySQL:
mysql -u std_notes_user -p
and entering the password, and that works.
What else could be causing this, or what can I do to try to troubleshoot further?
I faced the very same issue just like you described.
Finally what did the trick to me was removing the docker projects mysql directory and to recreate:
rm -rf ./data/mysql
mkdir data/mysql
After that the SyncServer ramped up without errors