将mysql表传输到服务器

I've set up a website on my local drive and created a table with xamp and php myadmin. The simple answer I'm asking is: how do I transfer the table into the server? I've tried to export the file with sql extension placing it in the root directory of the remote but that didn't work.

Simple, After Export the sql file, you need to Import it via phpmyadmin.

You need to import the data somehow, not just put the .sql file on your server. Try using phpMyAdmin, which is likely already installed on your production server.

In general, one would use mysqldump to create a dump and then import said dump on your server.

Another option to consider is using so called migrations. These are, basically, SQL scripts that introduce or remove changes to your table layout or necessary priming data.

A last option would be to use phpMyAdmin on your local environment and, again, import the created dump on your server using either phpMyAdmin (but you shouldn't really have that on a public-facing production server) or through the commandline.

You can export using phpMyAdmin as .sql format and import in the remote server either using phpMyAdmin (import) or by giving the file name as paramter to mysql command

Eg : mysql -u username -D databasename -p < filname.sql

replace username with your username & databasename with your datbasename to which the tables have to be imported and filename.sql as the filename to be imported

the filename.sql should be in your current directory where ever you are executing the mysql command from.

  1. Go to your localhost database and choose export as normal .sql file with no compression
  2. Go to your server database and choose import and import the .sql file that you have saved earlier

So you need to save the file as .sql no archieve and then choose import in your server sqladmin

export and import sql file of your table