15 days ago
I have a script from that script I created table in MySQL Workbench now I want to create table in railway but I don't know how to create with script
15 Replies
15 days ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
15 days ago
just use Railway's Query Tab:
Go to your Railway dashboard and click on your MySQL thing
Hit the "Data" or "Query" tab at the top
Copy your whole SQL script from MySQL Workbench and paste it in there
Hit "Execute"
That's it! Your tables should show up right away.
If it gives you errors:
Just delete these sql lines from your script (you don't need them):
SET @OLD_SQL_MODE=@@SQL_MODE...
SET SQL_MODE=...
-- Basically any SET stuff at the toponly keep the CREATE TABLE parts and run that.
15 days ago
And complementing the reply from bytekeim, you can also connect to your Railway DB using the MySQL Workbench.
You can get the public url and credentials from the Variables tab in your database service!
bytekeim
just use Railway's Query Tab:Go to your Railway dashboard and click on your MySQL thingHit the "Data" or "Query" tab at the topCopy your whole SQL script from MySQL Workbench and paste it in thereHit "Execute"That's it! Your tables should show up right away.If it gives you errors:Just delete these sql lines from your script (you don't need them):SET @OLD_SQL_MODE=@@SQL_MODE... SET SQL_MODE=... -- Basically any SET stuff at the toponly keep the CREATE TABLE parts and run that.
15 days ago
where?
Hit the "Data" or "Query" tab at the top
Attachments
15 days ago
look at the top right - there's a purple "Connect" button. click that!
It'll give you options to:
Use the built-in Query interface (this is what you want for running your sql script)
Or get connection details to use with MySQL Workbench
once you click Connect and choose the query option, you'll be able to paste your sql script directly and execute it
bytekeim
look at the top right - there's a purple "Connect" button. click that!It'll give you options to:Use the built-in Query interface (this is what you want for running your sql script)Or get connection details to use with MySQL Workbenchonce you click Connect and choose the query option, you'll be able to paste your sql script directly and execute it
15 days ago
15 days ago
go to your Railway MySQL service → Variables tab → copy the MYSQL_ROOT_PASSWORD → paste it in MySQL Workbench's password field → test connection
15 days ago
ah yeah, you're using 127.0.0.1 (localhost) in the screenshot - that won't work because Railway's database isn't on your local machine!
ou need to use the exact hostname and port from Railway:
hostname: shortline.proxy.rlwy.net
port: 48493
username: root
password: (get this from Railway's Variables tab - the MYSQL_ROOT_PASSWORD)
But honestly bro, just use Railway's built-in Query tool - click that "Connect" button in Railway, choose Query, and paste your SQL script there. Way easier than fighting with MySQL Workbench for this!
lmk what you did
15 days ago
I tried both I gave both screenshot and railway's built-in query tool I can't see whenever I click on the Connect button this Shows up
Attachments
15 days ago
Oh I see what's happening! railway is showing you how to connect from your application code, not giving you a query tool.
here's what you need to do:
then you have to use MySQL Workbench
for MySQL Workbench to work:
in Railway, go to your MySQL service → Variables tab
look for
MYSQL_ROOT_PASSWORD- click the eye icon to reveal the actual passwordcopy that password
go back to MySQL Workbench
click "Store in Vault..." button in the password field
paste the password you just copied
clik Test Connection
the key is you need to actually PASTE the password into the vault - just having the field say "Store in Vault..." means it's empty
bytekeim
Oh I see what's happening! railway is showing you how to connect from your application code, not giving you a query tool.here's what you need to do:then you have to use MySQL Workbenchfor MySQL Workbench to work:in Railway, go to your MySQL service → Variables tablook for MYSQL_ROOT_PASSWORD - click the eye icon to reveal the actual passwordcopy that passwordgo back to MySQL Workbenchclick "Store in Vault..." button in the password fieldpaste the password you just copiedclik Test Connectionthe key is you need to actually PASTE the password into the vault - just having the field say "Store in Vault..." means it's empty
15 days ago
this is what I'm getting
Attachments
15 days ago
use the Public Network connection instead
go back to Railway → Click Connect → Switch to "Public Network" tab
copy those connection details (they might be different)
use those in MySQL Workbench instead
Attachments
bytekeim
use the Public Network connection insteadgo back to Railway → Click Connect → Switch to "Public Network" tabcopy those connection details (they might be different)use those in MySQL Workbench instead
15 days ago
same
15 days ago
ok i will give you the last 2 thing to do then i will give up hhhhhh but u don't give up hhhh
first :
in MySQL Workbench, go to the "SSL" tab (next to Parameters)
set "Use SSL" to "If available" or "No"
try connecting again
if it doesnt work :
try Railway CLI instead (easiest tbh)
Open your terminal/command prompt and run:
railway login
railway link
railway connect MySQL
this will connect you directly and you can run your SQL script from there.
lmk know the result