R
Railway•5mo ago
debby

mysql

I have created a MySQL table. How to edit the value length? Because i didn't see any button or menu to do edit. Please help, TIA
56 Replies
Percy
Percy•5mo ago
Project ID: N/A
debby
debby•5mo ago
N/A
Brody
Brody•5mo ago
for this kind of thing i recommend dbgate
debby
debby•5mo ago
hi Brody, what is that? I'm new to this thing
Brody
Brody•5mo ago
a database client, have a look at their website - https://dbgate.org/
debby
debby•5mo ago
okay, will look for it. thank you! do you mind if I contact you if I have any question?
Brody
Brody•5mo ago
for railway questions, of course
debby
debby•5mo ago
[Solved] @Brody i want to link an Id as a foreign key from another table. How to set it? I just see is primary key in DbGate table setup I found it!
Brody
Brody•5mo ago
happy you found it, but thats not quite a railway question
debby
debby•5mo ago
I test the connection to my Android app, it keeps return 500. i have set the variable in .env same as railway variable. i don't know what's wrong
No description
Brody
Brody•5mo ago
what environment variables are you using in code for your mysql credentials?
debby
debby•5mo ago
i put railway variables in .env
No description
Brody
Brody•5mo ago
do you get this error when making a post request to your app running on railway?
debby
debby•5mo ago
yes, get the same error.. if connection successful it should be displaying user's data
No description
Brody
Brody•5mo ago
have you added the database credentials to your service variables? https://docs.railway.app/guides/variables#service-variables yeah, you haven't set any service variables click the banner and let it auto complete the variables for you if done right you shouldn't be copy pasting anything
debby
debby•5mo ago
I only added the railway variables for the public network. there are 2 for public and private, right? Does this matter? should I also add private variables? yes it's added automatically, but still not working
Brody
Brody•5mo ago
for your usecase the public variables are just fine can you send another screenshot of the service variables
debby
debby•5mo ago
MySQL
Backend
Brody
Brody•5mo ago
did you copy paste anything?
debby
debby•5mo ago
there was 'add all' button, it's added auto
Brody
Brody•5mo ago
okay, can you show me what the raw editor shows the variables as? hiding anything that is sensitive please (on on your app's service, I didn't need to see the variables on the mysql service)
debby
debby•5mo ago
ah, I inspect the RAW EDITOR .env file in service is in different format from .env in MySQL
Brody
Brody•5mo ago
don't worry about that right now, .env is not applicable for railway please show me a screenshot of the raw editor window for your apps service, hide anything that is sensitive
debby
debby•5mo ago
// App service
MYSQLDATABASE=[redacted]
MYSQLHOST=[redacted]
MYSQLPASSWORD=[redacted]
MYSQLPORT=[redacted]
MYSQLUSER=[redacted]
SECRET_KEY=[redacted]
// App service
MYSQLDATABASE=[redacted]
MYSQLHOST=[redacted]
MYSQLPASSWORD=[redacted]
MYSQLPORT=[redacted]
MYSQLUSER=[redacted]
SECRET_KEY=[redacted]
Brody
Brody•5mo ago
so if you had to redact those database variables, it means you didn't let it auto complete
debby
debby•5mo ago
i have ensure all the values are the same as MySql
Brody
Brody•5mo ago
please delete the database variables and use the auto complete if you at any point copy paste something you would be doing it incorrectly https://docs.railway.app/guides/variables#autocomplete-dropdown
debby
debby•5mo ago
wait, let me delete all
debby
debby•5mo ago
No description
Brody
Brody•5mo ago
do not use that
debby
debby•5mo ago
not 'add all' button?
Brody
Brody•5mo ago
your .env file should absolutely not be in your repo
debby
debby•5mo ago
yes I forgot to use .gitignore ;_;
Brody
Brody•5mo ago
use the auto complete as shown here
debby
debby•5mo ago
done, still not working.. hmm
Brody
Brody•5mo ago
well now lets see what the raw editor has
debby
debby•5mo ago
Database
Backend Service
Brody
Brody•5mo ago
alright that will do please delete the .env file from the repo and get it in the .gitignore file
debby
debby•5mo ago
okiee, pls wait done Brody. I delete again all variables in service. what to do next? do the same to import auto complete variables through the dropdown?
Brody
Brody•5mo ago
use the autocomplete to add these variables to the service
debby
debby•5mo ago
done. still error 500 in the service's settings, I use the public URL in my Android Retrofit it's https right?
Brody
Brody•5mo ago
yes https what do the deploy logs say in your railway deployment?
debby
debby•5mo ago
Server is running on port 6949
Brody
Brody•5mo ago
thats all?
debby
debby•5mo ago
yess
Brody
Brody•5mo ago
well thats not helpfull you will need to add debug logging to your app
debby
debby•5mo ago
console.log('Generated Token:', token); I add this log in script
Brody
Brody•5mo ago
you need more verbose logging, theres a code issue here but theres not enough logging to find out whats going on
debby
debby•5mo ago
can I post the logcats here?
Brody
Brody•5mo ago
yes
debby
debby•5mo ago
2024-01-26T04:11:10.455Z - Server is running on port 6621
2024-01-26T04:11:15.455Z - POST /api/login
Database error: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Sequence._packetToError (/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/app/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/app/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/app/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/app/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
--------------------
at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
at Connection._implyConnect (/app/node_modules/mysql/lib/Connection.js:454:10)
at Connection.query (/app/node_modules/mysql/lib/Connection.js:196:8)
at /app/index.js:35:14
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
at next (/app/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/app/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) {
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
}
2024-01-26T04:11:10.455Z - Server is running on port 6621
2024-01-26T04:11:15.455Z - POST /api/login
Database error: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at Sequence._packetToError (/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/app/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/app/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/app/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/app/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (/app/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
--------------------
at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
at Connection._implyConnect (/app/node_modules/mysql/lib/Connection.js:454:10)
at Connection.query (/app/node_modules/mysql/lib/Connection.js:196:8)
at /app/index.js:35:14
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
at next (/app/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/app/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) {
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
}
not supported authentication mode, what does it mean? I use JWT token btw before I deploy to railway it's working fine (running on local IP) i don't know what's wrong 😭
Brody
Brody•5mo ago
okay now we getting somewhere you need to use the mysql2 npm package instead
debby
debby•5mo ago
Server is running on port 6562
2024-01-26T04:32:26.159Z - POST /api/login
Generated Token: [redacted]
2024-01-26T04:32:27.358Z - GET /api/fetch
Server is running on port 6562
2024-01-26T04:32:26.159Z - POST /api/login
Generated Token: [redacted]
2024-01-26T04:32:27.358Z - GET /api/fetch
it works!!! aaah thank you very much Brody
Brody
Brody•5mo ago
no problem!
debby
debby•5mo ago
I'm going to get my lunch soo have a nice day!
Brody
Brody•5mo ago
you too!