How do I go about transferring a MySQL database from my localhost to a remote server? Can it only be done in a command prompt? Right now, I'm running MySQL 5.1 with a Command Line Prompt and Query Browser. In SQL Server, you just take the DB offline, copy the .mdf file over, and you're done, but it doesn't seem to be that simple. Thanks!
http://dev.mysql.com/doc/refman/5.0/en/copying-databases.html should be quite helpful.
Related
How do I install MySQL Workbench properly? Can't connect to the SQLTools extension in VSCode.I'm new to the database scene, and can't seem to grasp how to create a successful SQL server that I can use to manipulate data. But nothing I'm doing seems to work.
Should I use Gitbash to access the terminal? I tried using my password to make a new query but it wouldn't work on the workbench. I don't know how to start the SQL server in addition to not knowing how to properly change the profile for the Workbench from a previous account. A new developer, such as myself, would appreciate any insight!
So that's really simple just install the mysql community server installer using this link https://dev.mysql.com/downloads/mysql/
Make sure to select the server only in the setup during installation if you are going to be using VS code as the client to manipulate sql queries
Then once that is done copy the bin path location from the mysql file directory (which is usually in the program files on your \C: drive on your computer) to the environment variables on your computer so that you can access mysql from the command line
Once that is done you can initialise a database from the normal command line but first type mysql -u root -p to start mysql in the command line
Then download the sql tools extension on vs code and create the database that wish
I got a project cloned from github. I need to export database that is placed in the repo. But I do not any ideas how to get it.
I installed Workbench, made MySQL Connection with username, login, hostname: localhost, port 3306. But I have no idea what to do next. I am a newbie in SQL.
I think you cloned some .sql and what to know how to insert this in your mySQL server right? If i understand it right you should try this step.
Create MySQL Server so if you don't have some you can download community version
https://dev.mysql.com/downloads/mysql/ that's free
Ppen MySQL Workbench
Connect your MySQL server with MySQL workbench
In file menu click that and choose "Run SQL Script" and open file that you cloned
run
SQL Script will make your database
I have been using MySql Workbench to connect to a local MySql server and to remote MySql Servers. The last couple of days the Workbench freezes when I connect to the local version. It still works for the remote servers.
I am using workbench 6.3.4 and then tried 6.2.5 just to see if it is a version issue.
I also can access the local MySql instance using HeidiSQL.
Any recommendations on what to look for?
Update
The advice to recreate the connection solved the issue. I just created a new one and it works fine.
A couple of things you can try:
Try restarting the sql server (remember, workbench is just a utility for accessing a db, it does not host the database for you)
See if you can access mysql on the command prompt / terminal, the command for mac & windows
(once you navigate to the mysql folder, try the command:)
mysql -u root
(if you have a password-protected account, the command will be
mysql -u someuser -p
If the above doesn't work, mysql is either offline or denying you access (depending on response), and you'll need to setup the server / assign privileges.
If all else fails, it may help to try another version of SQL / Workbench (for a easy-to-use sql sever setup, I'd recommend WAMP or MAMP, assuming you want a HTTP server bundled with it)
Additionally, it may help to recreate the local connection in workbench (of if your getting regular crashes, reinstall & update workbench). Good luck with it.
I have an SQL script that creates new DB and tables. Now I want to run this script in order to create DB and tables on the remote server (perhaps, using Windows PowerShell). How can I do this?
Note: MySQL and all other tools are already installed on the remote server. I have its IP, username and password. The only thing I want to do is to run my SQL script on this remote server.
In my opinion, the easiest way is using MySQL Workbench (or any other similar tool): https://www.mysql.com/products/workbench/
Here is also step by step tutorial:
http://docs.oracle.com/cd/E19078-01/mysql/mysql-workbench/wb-getting-started-tutorial.html
I have a local Perl script that does a lot of parsing of web pages and then successfully updates my local MySQL database (WAMP server). I now want to send this local data to my remote server, but remotely connecting to my database isn't allowed with my hosting company. Unfortunately I never thought of that problem.
So, I now need to find an automated way to update my remote server (every 15mins). I mistakenly thought I could just edit my Perl script with the details of the remote server.
I am aware that I could use CGI or PHP to do the parsing on the server, but I really want to keep the parsing local for now.
Summary:
Local MySQL database -> remote MySQL database every 15mins ??
Any ideas what I can do?
Thanks :-)
if replication is not an option but you can still establish an ssh connection from local box to remote box, then
run mysqldump to export data into a file http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_where
scp file to remote box
mysql -u username -p password database_name < dumpfile.sql
If your server does not accept connections to mysql remotely you can create a ssh tunnel. Then you can apply the replication solution proposed by matcheek.
Here is a hint: http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html
Based on the responses I've received, I think the answer to my original question is to stop using a cheap shared hosting company (no remote access to server, no cron jobs, etc) and start using a VPS hosting company. That will give me the freedom to remotely connect to my server, etc.
Thanks again to those who replied.
From how you described the problem replication seems to be the way to go
http://dev.mysql.com/doc/refman/4.1/en/replication-howto.html
Using a cron job could be another option. It would read file from your local machine and import data in the remote box.
I suggest the follwing:
On every local run, write the SQL statements (sans SELECT),
that you run against your copy of the DB also into a file
On your WAMP server create a small PHP script, gives back the oldest script from the first step (soem auth ofcourse)
On your remote server run a cronjob, that gets this from your local server and runs the SQL against the DB, then acknowledges it
On acknowledgement on your WAMP server, drop the file and give back the next one.
While this seems complicated, it allows for a restart after connectivity loss - something that I consider imposrtant.