Muitos usuários do WordPress preferem trabalhar em seus sites usando um servidor local em seus computadores antes de transferi-los para um servidor de hospedagem ao vivo.
Ele permite que você trabalhe em seu site de forma privada antes de disponibilizar essas alterações on-line.
Eventualmente, você precisará movê-lo para um servidor ativo para disponibilizá-lo aos visitantes on-line.
Neste artigo, mostraremos instruções passo a passo sobre como mover o WordPress de um servidor local para um site ativo.
![How to move WordPress from local server to live site (2 methods) How to move WordPress from local server to live site (2 methods)](https://www.wpbeginner.com/wp-content/uploads/2021/09/move-WordPress-site-from-local-server-to-live-site-og.png)
Por que mover o WordPress de um servidor local para um site ativo?
Criar seu blog WordPress em um servidor local é uma maneira segura de testar as alterações em seu site sem afetar os visitantes.
Quando você terminar de aperfeiçoar seu site, a próxima etapa é passar do servidor local para um site ativo.
Vamos mostrar duas maneiras de mover seu site de um servidor local para um site ativo.
O primeiro método usa um plug-in de migração do WordPress e é recomendado para iniciantes.
No segundo método, mostraremos como mover manualmente o WordPress de um servidor local para um site ativo.
Você pode escolher o método que funciona melhor para você:
Antes de migrar seu site WordPress
Para migrar o WordPress de um servidor local para um servidor ativo, você precisa ter alguns aspectos em vigor.
Primeiro, supomos que você tenha um site WordPress em execução em um servidor local (também chamado de localhost) no seu computador e que tenha acesso total a ele.
Em seguida, você precisará ter um nome de domínio e uma hospedagem na Web.
Para facilitar sua decisão, recomendamos o uso da Bluehost. Eles são uma empresa de hospedagem WordPress oficialmente recomendada e estão oferecendo aos usuários do WPBeginner um desconto exclusivo + domínio e SSL gratuitos.
Basicamente, você pode começar por apenas US$ 1,99 por mês.
Se você quiser uma ótima alternativa ao Bluehost, pode dar uma olhada no Hostinger. Eles também estão oferecendo um desconto exclusivo para usuários do WPBeginner com um nome de domínio gratuito.
Se você puder pagar um pouco mais, dê uma olhada no SiteGround. Eles também têm uma oferta especial para os leitores do WPBeginner.
Se precisar de ajuda para configurar seu site, siga nosso guia passo a passo sobre como criar um site.
Por fim, você precisará de um programa de FTP e saberá como usar o FTP para fazer upload do site do servidor local para o site ativo.
Pronto? Vamos começar a migrar seu site WordPress.
Tutorial em vídeo
Se você preferir instruções por escrito, continue lendo.
Método 1: Transferir o WordPress do servidor local para o site ativo usando um plug-in de migração (recomendado)
Esse método é mais fácil e recomendado para iniciantes. Usaremos um plugin de migração do WordPress para mover o WordPress do host local para um site ativo.
Etapa 1: Instalar e configurar o plug-in do Duplicator
Primeiro, você precisa instalar e ativar o plug-in do Duplicator em seu site local. Para obter mais detalhes, consulte nosso guia passo a passo sobre como instalar um plug-in do WordPress.
Dica profissional: Há também uma versão profissional do Duplicator que oferece backups seguros, armazenamento em nuvem, restauração fácil do site e muito mais.
Após a ativação, você precisa ir para a página Duplicator ” Packages (Pacotes ) e clicar no botão “Create New” (Criar novo).
![Create new package for migration Create new package for migration](https://www.wpbeginner.com/wp-content/uploads/2019/01/create-new-package.png)
Isso o levará a uma tela na qual você poderá dar um nome ao backup.
Em seguida, clique no botão “Next” (Avançar).
![Name backup package Name backup package](https://www.wpbeginner.com/wp-content/uploads/2019/01/name-backup-duplicator.png)
O Duplicator agora executará alguns testes para verificar se tudo está em ordem.
Se todos os itens estiverem marcados como “Bom”, clique no botão “Construir”.
![Build package Build package](https://www.wpbeginner.com/wp-content/uploads/2019/01/build-package.png)
Esse processo pode levar alguns minutos, dependendo do tamanho de seu site. Você precisa deixar essa guia aberta até que o processo seja concluído.
Quando terminar, você verá opções de download para os pacotes “Installer” e “Archive”. Você precisa clicar no link “One-Click Download” para baixar os dois arquivos para o seu computador.
![Download package files Download package files](https://www.wpbeginner.com/wp-content/uploads/2019/01/download-package-files.png)
O arquivo “Archive” é uma cópia completa do seu site WordPress. Ele inclui todos os arquivos principais do WordPress, bem como suas imagens, uploads, temas, plug-ins e um backup do seu banco de dados do WordPress.
O arquivo “Installer” é um script que automatizará todo o processo de migração, descompactando o arquivo que contém seu site.
Etapa 2: Crie um banco de dados para seu site WordPress ativo
Antes de executar o instalador ou carregar o site do WordPress do host local para o servidor de hospedagem, é necessário criar um banco de dados MySQL para o novo site ativo.
Se você já tiver criado um banco de dados MySQL, poderá pular esta etapa.
Para criar um banco de dados, você precisa acessar o painel do cPanel da sua conta de hospedagem. Em seguida, localize a seção “Databases” (Bancos de dados) e clique no ícone “MySQL Database Wizard” (Assistente de banco de dados MySQL).
![MySQL Database Wizard MySQL Database Wizard](https://www.wpbeginner.com/wp-content/uploads/2019/01/mysqldatabasewizard.png)
Na tela seguinte, há um campo para criar um novo banco de dados.
Basta fornecer um nome para o seu banco de dados e clicar no botão “Create Database” (Criar banco de dados).
![Name new database Name new database](https://www.wpbeginner.com/wp-content/uploads/2021/09/name-new-database.png)
O cPanel criará um novo banco de dados para você.
Depois disso, é necessário inserir um nome de usuário e uma senha para o novo usuário e, em seguida, clicar no botão “Create User” (Criar usuário).
![Create new database user Create new database user](https://www.wpbeginner.com/wp-content/uploads/2021/09/create-new-database-user.png)
Em seguida, você precisa adicionar o usuário que acabou de criar ao banco de dados.
Primeiro, clique na caixa de seleção “All Privileges” (Todos os privilégios).
![Check all privileges Check all privileges](https://www.wpbeginner.com/wp-content/uploads/2021/09/check-all-privileges.png)
Em seguida, role a tela para baixo e clique no botão “Make Changes” (Fazer alterações) para salvar suas alterações.
Seu banco de dados está pronto para ser usado com seu site WordPress. Não se esqueça de anotar o nome do banco de dados, o nome de usuário e a senha. Você precisará dessas informações na próxima etapa.
Etapa 3: Fazer upload de arquivos do servidor local para o site WordPress ativo
Agora, você precisa carregar o arquivo e os arquivos do instalador do seu site local para a sua conta de hospedagem.
Primeiro, conecte-se ao seu site ativo usando um cliente FTP. Uma vez conectado, certifique-se de que o diretório raiz de seu site esteja completamente vazio.
Normalmente, o diretório raiz é a pasta /home/public_html/
.
Algumas empresas de hospedagem WordPress instalam automaticamente o WordPress quando você se inscreve. Se você tiver arquivos do WordPress lá, precisará excluí-los.
Depois disso, você pode carregar os arquivos archive.zip e installer.php do Duplicator para seu diretório raiz vazio.
![Upload archive and installer files Upload archive and installer files](https://www.wpbeginner.com/wp-content/uploads/2021/09/upload-archive-installer.png)
Etapa 4: Execução do script de migração
Depois de fazer o upload dos arquivos de migração, você precisa visitar o seguinte URL no navegador:
http://example.com/installer.php
Não se esqueça de substituir “example.com” por seu próprio nome de domínio.
Isso iniciará o assistente de migração do Duplicator.
O instalador executará alguns testes e inicializará o script.
![Duplicator migration wizard step 1 Duplicator migration wizard step 1](https://www.wpbeginner.com/wp-content/uploads/2019/01/duplicator-dbsettings.png)
Na seção Setup (Configuração), você será solicitado a inserir o host do MySQL, o nome do banco de dados, o nome de usuário e a senha.
Seu host provavelmente será localhost. Depois disso, você digitará os detalhes do banco de dados que criou na etapa anterior.
Em seguida, clique no botão “Validate” (Validar) para garantir que os detalhes inseridos estejam corretos.
![Validate settings Validate settings](https://www.wpbeginner.com/wp-content/uploads/2019/01/duplicator-validate.png)
Depois disso, clique no botão “Next” (Avançar) para continuar.
O Duplicator agora importará o backup do banco de dados do WordPress do arquivo para o novo banco de dados.
Ele também atualizará os URLs que apontam para o site local para seu novo site ativo.
Agora você pode clicar no botão “Admin Login” para entrar na área de administração do WordPress do seu site ativo.
![Admin login Admin login](https://www.wpbeginner.com/wp-content/uploads/2019/01/adminlogin.png)
Quando você fizer login no site ativo, o Duplicator limpará automaticamente os arquivos de instalação.
Isso é tudo. Você transferiu com êxito o WordPress do servidor local para o site ativo.
Método 2: Transferir manualmente o WordPress do servidor local para o site ativo
Neste método, mostraremos como mover manualmente o WordPress do servidor local para seu site ativo. Ele será útil se o primeiro método não funcionar ou se você preferir fazer isso manualmente.
Etapa 1: Exportar o banco de dados local do WordPress
A primeira coisa que você precisa fazer é exportar seu banco de dados local do WordPress. Usaremos o phpMyAdmin para fazer isso.
Se não estiver familiarizado com ele, talvez queira dar uma olhada em nosso guia sobre gerenciamento de banco de dados do WordPress usando o phpMyAdmin.
Basta acessar http://localhost/phpmyadmin/
e clicar em seu banco de dados do WordPress. Em seguida, clique no botão “Export” na barra de menu superior.
![Export from localhost Export from localhost](https://www.wpbeginner.com/wp-content/uploads/2017/01/localhost-export.png)
Na opção “Export method:” (Método de exportação), você pode escolher “Quick” (Rápido) ou “Custom” (Personalizado). A opção Personalizada lhe dará mais opções para exportar seu banco de dados.
Mas recomendamos escolher “Quick” (Rápido) e clicar no botão “Go” (Ir) para fazer o download do banco de dados.
![Export WordPress database using phpMyAdmin Export WordPress database using phpMyAdmin](https://www.wpbeginner.com/wp-content/uploads/2019/01/exportdb.png)
Etapa 2: Faça upload dos arquivos do WordPress para o site ativo
Agora, precisaremos mover todos os arquivos do seu site para o site ativo.
Para começar, abra seu cliente FTP e conecte-se à sua conta de hospedagem na Web.
Depois de se conectar ao seu site ativo, certifique-se de carregar os arquivos no diretório correto. Por exemplo, se você quiser que o site seja hospedado em “yoursite.com”, deverá carregar todos os arquivos no diretório public_html
.
Agora, selecione seus arquivos locais do WordPress e carregue-os no servidor ativo.
![Upload WordPress files FTP Upload WordPress files FTP](https://www.wpbeginner.com/wp-content/uploads/2021/09/upload-wordpress-files-ftp.png)
Etapa 3: Crie um banco de dados MySQL em seu site ativo
Enquanto o cliente FTP estiver carregando os arquivos do WordPress, você poderá começar a importar o banco de dados para o servidor ativo.
A maioria dos provedores de hospedagem WordPress oferece o cPanel para gerenciar sua conta de hospedagem, portanto, mostraremos como criar um banco de dados usando o cPanel.
Primeiro, é necessário fazer login no painel do cPanel e clicar no ícone “MySQL Database Wizard” (Assistente de banco de dados MySQL), que pode ser encontrado na seção “Databases” (Bancos de dados).
![Select MySQL database wizard Select MySQL database wizard](https://www.wpbeginner.com/wp-content/uploads/2021/09/select-mysql-database-wizard-1.png)
Na tela seguinte, você pode criar um novo banco de dados.
Você precisa fornecer um nome para o banco de dados e, em seguida, clicar em “Create Database” (Criar banco de dados).
![Name and create new database Name and create new database](https://www.wpbeginner.com/wp-content/uploads/2021/09/name-new-database-1.png)
O cPanel criará automaticamente um novo banco de dados para você.
Em seguida, é necessário inserir um nome de usuário e uma senha para o novo usuário e clicar em “Create User” (Criar usuário).
![Create new database user Create new database user](https://www.wpbeginner.com/wp-content/uploads/2021/09/create-new-database-user-1.png)
Depois disso, você precisa adicionar o usuário que acabou de criar ao banco de dados.
Primeiro, marque a caixa de seleção “All Privileges” (Todos os privilégios).
![Check all privileges checkbox Check all privileges checkbox](https://www.wpbeginner.com/wp-content/uploads/2021/09/check-all-privileges-1.png)
Em seguida, role a tela para baixo e clique em “Make Changes” (Fazer alterações) para salvar suas alterações.
Você criou com sucesso um novo banco de dados para seu site WordPress ativo.
Etapa 4: Importar o banco de dados do WordPress para o site ativo
A próxima etapa do processo é importar seu banco de dados do WordPress.
Vá para o painel do cPanel, role para baixo até a seção “Databases” (Bancos de dados) e clique em “phpMyAdmin”.
![Click on phpMyAdmin Click on phpMyAdmin](https://www.wpbeginner.com/wp-content/uploads/2021/09/select-phpmyadmin.png)
Isso o levará ao phpMyAdmin, onde você deverá clicar no banco de dados que acabou de criar acima. O phpMyAdmin mostrará seu novo banco de dados sem tabelas.
Em seguida, clique na guia “Import” (Importar) no menu superior. Na página de importação, clique no botão “Choose File” (Escolher arquivo) e selecione o arquivo de banco de dados do site local que você salvou na primeira etapa.
![Import database via phpMyAdmin Import database via phpMyAdmin](https://www.wpbeginner.com/wp-content/uploads/2019/01/phpmyadminimport.png)
Depois disso, clique no botão “Go” (Ir) na parte inferior da página. Seu banco de dados será importado automaticamente para o phpMyadmin.
Etapa 5: Alterar o URL do site
Agora, você precisa alterar o URL do site no banco de dados para que ele se conecte ao seu site WordPress ativo.
No phpMyAdmin, procure a tabela wp_options
em seu banco de dados que você acabou de importar acima.
Se você alterou o prefixo do banco de dados, em vez de wp_options
, pode ser {new_prefix}_options
.
Em seguida, clique no botão “Browse” (Procurar) ao lado de wp_options
. Ou clique no link na barra lateral para abrir a página que tem uma lista de campos na tabela wp_options
.
![Browse the wp options table Browse the wp options table](https://www.wpbeginner.com/wp-content/uploads/2017/01/browse-wp-options.jpg)
Em seguida, na coluna options_name
, você precisa procurar a opção siteurl
.
Em seguida, clique no ícone “Editar”.
![Edit siteurl in phpMyAdmin Edit siteurl in phpMyAdmin](https://www.wpbeginner.com/wp-content/uploads/2017/01/siteurl.png)
Isso abre uma janela na qual você pode editar o campo.
Na caixa de entrada para option_value
, você verá o URL da sua instalação local, que será algo como http://localhost/test.
Você precisa inserir o URL do novo site nesse campo, por exemplo: https://www.wpbeginner.com.
Em seguida, você pode salvar o campo clicando no botão “Go” (Ir).
![edit the siteurl field edit the siteurl field](https://www.wpbeginner.com/wp-content/uploads/2017/01/edit-siteurl.jpg)
Em seguida, você precisa seguir as mesmas etapas descritas acima para o nome da opção home
. O menu wp_options
pode ter algumas páginas. Normalmente, a opção home
estará na segunda página.
Em seguida, atualize o URL da página inicial
para que ele seja igual ao URL do site ativo.
Etapa 6: Configure seu site ativo
Agora que você importou o banco de dados e fez o upload do conteúdo, é hora de configurar o WordPress.
Nesse momento, seu site deve estar exibindo o erro“Erro ao estabelecer uma conexão com o banco de dados“.
Para corrigir isso, conecte-se ao seu site usando um cliente FTP e abra o arquivo wp-config.php
.
Você procurará as seguintes linhas de código:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Você precisará fornecer o nome do banco de dados, o nome de usuário e a senha que criou anteriormente.
Em seguida, salve o arquivo wp-config.php
e carregue-o novamente no servidor de hospedagem do WordPress.
Agora, quando você acessar seu site, ele deverá estar ativo.
Depois disso, você precisa fazer login no painel de administração do WordPress e ir para Configurações ” Geral. Em seguida, sem alterar nada, role até a parte inferior e clique no botão “Salvar alterações”.
![Save general settings Save general settings](https://www.wpbeginner.com/wp-content/uploads/2021/09/save-general-settings.png)
Isso garantirá que o URL do seu site seja corrigido em qualquer outro lugar que seja necessário.
Depois de fazer isso, vá para Configurações ” Permalinks, role para baixo e clique em “Salvar alterações” para garantir que todos os links de postagem estejam funcionando bem.
![Save permalinks settings Save permalinks settings](https://www.wpbeginner.com/wp-content/uploads/2021/09/save-permalinks-settings.png)
Etapa 7: Corrigir imagens e links quebrados atualizando os caminhos
Sempre que estiver movendo um site do WordPress de um domínio para outro ou de um servidor local para um site ativo, você se deparará com links quebrados e imagens ausentes.
Uma maneira simples de atualizar os URLs é usar a seguinte consulta SQL:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');
Basta acessar o phpMyAdmin, clicar em seu banco de dados e, em seguida, clicar em “SQL” no menu superior e adicionar a consulta acima.
Certifique-se de alterá-lo para os URLs do seu próprio site local e do site ativo e clique no botão “Go” (Ir).
![Fixing WordPress images and broken URLs after moving to live site Fixing WordPress images and broken URLs after moving to live site](https://www.wpbeginner.com/wp-content/uploads/2017/01/run-sql.jpg)
É isso aí. Agora você migrou com sucesso o WordPress do seu servidor local para um site ativo.
Esperamos que seu site ativo esteja funcionando sem problemas. Se você notar algum erro, consulte nosso guia de erros comuns do WordPress para obter ajuda na solução de problemas.
Esperamos que este artigo tenha ajudado você a mover o WordPress de um servidor local para um site ativo. Talvez você também queira ver nosso guia sobre como criar um boletim informativo por e-mail da maneira correta ou ver nossa comparação das melhores alternativas de hospedagem da GoDaddy.
Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
sam says
Isn’t it better to use a duplicator plugin instead of taking all this trouble as described in here
or here
I think using the duplicator is a easier. Feel free to add or correct me.
WPBeginner Support says
Yes, we have mentioned using Duplicator or BackupBuddy as the easier ways to do this in the article.
Administrador
Louise says
Thanks so much for an excellent article – very straight forward and easy to understand.
fadilah says
hi, i’m getting a problem with my permalink, my permalink is still pointed to my localhost something like fadil.dev so when i add a post/page, the permalink is pointed to my fadil.dev/?p=ID it should be pointed to fadil.com (my real domain) and not fadil.dev (my local domain) .. where i can find the configuration ? help me .. thankyou![:)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_smile.gif)
WPBeginner Support says
Fadilah: did you try instructions in step 7.
Administrador
fadilah says
my article/page works fine on the front-end, but the permalink on wp-admin when i added a new post/page appeared wrong , you can see my printscreen http://prntscr.com/2cfznc .. it should be terazam.com not terazam.dev
WPBeginner Support says
yes it does look like you have not set your home and site URL.
fadilah says
no, i didn’t try the 7th step, but this is my problem http://prntscr.com/2cfznc
WPBeginner Support says
Seems like you didn’t change your site and home URLs either. Please follow all the steps mentioned above and your problem should get resolved.
fadilah says
i had changed my siteurl according to your instruction at 5th step before i asked this problem and my front-end issue was solved, thankyou
… but it seems that when i changed the siteurl on wp_options table there was no effect with permalink on my wp-admin ![:(](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_sad.gif)
fadilah says
SOLVED![:)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_smile.gif)
i found the config on Administration > Settings > General and you will find the “Site Address URL” and i changed it into the correct value. so WordPress Address and Site Address are different. i found it on wp documentation http://codex.wordpress.org/Moving_WordPress
thankyou for your help
have a nice day
prox says
nice tutorial i was thinking to do and found your website luckily and also i would like to ask two thing
1. what’s this footer advertisement option is it a plugin ?
2 what’s the plugin your using for newsletter i saw when i enter to your site there’s nice pop up banner that saying do you want to lean about WordPress and then enter your email address
please share if you don’t mind
thank you
WPBeginner Support says
Yes the message in the floating footer bar on our website is a plugin that we use to add sticky floating footer bar on our website.
As for the newsletter we use OptinMonster to create optin form lightbox popup that you noticed.
Administrador
Nathan says
Great help, thanks!
One question, if I buy a theme, can I use it on both my local and live site even though they are different installations and thus have different WordPress id’s?
I am building my first live site but I have set up a local to play with the designs and construct the content.
Thanks.
WPBeginner Support says
Nathan, this is a theme licensing question and the themeshop you purchased it from would be better able to answer this. However, we don’t see any harm in that.
Administrador
Deepo says
wonderful tutorial. complexity made simple
Matt says
Hi. Firstly I’d like to thank you, this process was easy to understand and errorless on your end!
My one hang-up was at the very end. I put in the SQL code in order to fix some linking errors, but must not have put the right local host because some small inconsistencies were not fixed. I have been using MAMP and accessing my site by going to “localhost:8888” Is this what I should put in that Step 7 code, or is there a different path?
WPBeginner Support says
Matt first you need to make sure that inside your wp_posts table you are using localhost:8888 inside post content. If yes, then use this in the step 7. If you are seeing all your links as localhost, then use localhost.
Administrador
Dayomaks says
All instructions works fine, thanks, i am so glad, but the issue i am having now is importing my database…while trying to import my database to a live server i got these errors below:
Error
SQL query:
—
— Database: `soundmode`
—
— ——————————————————–
—
— Table structure for table `xs_commentmeta`
—
CREATE TABLE IF NOT EXISTS `xs_commentmeta` (
`meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT ‘0’,
`meta_key` VARCHAR( 255 ) DEFAULT NULL ,
`meta_value` LONGTEXT,
PRIMARY KEY ( `meta_id` ) ,
KEY `comment_id` ( `comment_id` ) ,
KEY `meta_key` ( `meta_key` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;
MySQL said: Documentation
#1046 – No database selected
ANY ASSISTANCE ON THERE?
WPBeginner Support says
Check your database name, username, and password to make sure that you are using the correct settings to connect to your live site’s database.
Administrador
Christie Bellah says
This worked great, thanks! In the past I had installed WordPress in the new hosting, dropped database tables, imported, etc. – this is so much faster and simpler.
Stefano says
First of all, thanks for the tutorial – invaluable and well written.
Unfortunately, I managed to get stuck anyway.
I uploaded everything via filezilla and phpmyadmin, and when i try to go to my domain it doesn’t show up any error. But nothing else, either.
Just a blank page – which is weird, because by typing /wp-admin at the end of the url i DO have access to the wordpress control panel, and every page seems to be all right.
Sorry to bother, but I really have no clue about what’s happening..
Thanks in advance!
Stefano says
Solved!
Apparently, it had some issues with the theme loading.
I couldn’t use the children theme i had worked on, but luckily I had changed just a couple of thing, so no big deal..
WPBeginner Support says
Stefano, did you follow the step 5? It seems like you have not changed site URL
Administrador
Stefano says
I did, and in fact the url worked (even if it showed just a blank page).
I still have no clue about what happened, but setting up the theme again solved it.
Lucky shot =P
javed choudahry says
Hi
Sir
Thanku so much .This website is very good for wordpress learn and very help full .
sesan says
please am having an error from step 4
SQL query:
—
— Database: `wordpress`
—
CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
MySQL said: Documentation
#1044 – Access denied for user ‘Admin7393’@’%’ to database ‘wordpress’
WPBeginner Support says
Sesan, the export file prepared by phpmyadmin to import into your live site database, contains a line to check if a database exists if not then it tries to create it. To resolve this issue, you need to extract the zip archive you created. Inside it you will find a file with
.sql
extension. Open this file in a text editor like Notepad and then delete these linesCREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Below this line you will see another line like this
USE `wordpress`;
Replace wordpress with the name of the database you are trying to import into.
Save your changes and put the sql file back into a zip archive (if it is too big, other wise you can also import it as it is).
Administrador
sesan says
men you guys are d bomb it worked thank youuuuuuuuuuuuu!!!!!!!!!!!!!!
Tyler says
Hi, thanks for the tutorial!
I’m struggling with Step 2. Your tutorial shows several files/folders being uploaded whereas I only have wordpress.sql.gz from Step 1. I can’t seem to extract the file using any software but can open using a text editor.
Any help would be greatly appreciated!
WPBeginner Support says
In the second step, you do not need to upload your phpMyAdmin export file (wordpress.sql.gz in your case). You need to upload your WordPress files which are located in htdocs or www folder of your localhost
Administrador
Tyler says
Thanks for the fast reply!
Mario says
do I need a cpanel to do this procedure? I am using a plugin to backup and export databases already, unfortunately the host provider that the client is using does not have a cpanel.
WPBeginner Support says
Mario, if your client’s web host does not have cPanel or phpMyAdmin, then you can try one of the methods described in our beginner’s guide on how to restore WordPress from Backup.
Administrador
Rhomy Prama Dhieka (Web Designer) says
thanks for sharing.
it help me alot migrating my wp website.
would you mind if i translte this to my language, then i will put ur credit there ?
thanks.
Adelio Fioritto says
Everything perfect, just update http://www.yourlivesite.com to http://www.yourlivesite.com/ in db query![;)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_wink.gif)
ryan says
hi, i am using stablehost and have used them before with WP websites. I followed all your steps and I am getting a parked page from my hosting provider…
WPBeginner Support says
There can be several reasons for that. First make sure that you have installed WordPress in the root directory of your website. If you did then make a backup of your .htaccess file and delete the one from root directory of your website. If that doesn’t work, then find the default parked page files there might be an index.html file on your web server delete that file (Do Not delete index.php). If none of these help then contact your hosting provider.
Administrador
Alex says
Thanks!
I did a search for the ‘‹’ character in the extracted .sql file, but got an alert saying: The string ‘‹’ was not found.
I don’t know if this matters, but I noticed that my local phpMyadmin version is 5.5.3, while my host’s phpMyadmin version is 3.5.8.2.
Another note is that I had all my WordPress files already up on my public_html directory (which is your step 2) BEFORE exporting my local WordPress database (which is your step 1). I’m not sure if it makes a difference.
I’ll try starting over with step 1, as you suggested, and if I get the same error then I may try the Duplicator plugin that you mentioned.
Alex
PatoPanichelli says
You really helped me. This step by step is awesome, I had no problems migrating from MAMP to a live site. Thanks
Alex says
Thanks for the tutorial!
Everything’s gone well until I get to the end of step 4. When I press the Go button at the bottom of the page, instead of having phpMyadmin import my WordPress database I get an error message that reads as follows:
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‹’ at line 1
Can you let me know what you think may be causing this?
Alex
WPBeginner Support says
Alex, it seems like the database file you are trying to import has a character ‘‹’ which is not supposed to be there. You have two options to fix that, first option is go back to your localhost/phpmyadmin and export your local database again and then try to import it again. If the same error occurs again, then extract your database gzip file using 7zip program. Open the .sql file in a text editor like notepad and look at the first line. Also take a look at our database management using phpMyAdmin guide to learn more.
Administrador
Anna says
Make sure you clicked on the database name on the lefthand side that you’d like to import to. Make sure that is highlighted and then try again. (phpMyAdmin version 4.0.8).
qs says
I get this error when I import datebase into live site. How do i solve it?
Error
SQL query:
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
—
— Database: `wordpress`
—
CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
MySQL said:
#1044 – Access denied for user ‘bossaballsg’@’10.%’ to database ‘wordpress’
WPBeginner Support says
Try checking MySQL user privileges to make sure that the database user can perform these operations.
Administrador
Chathuranga says
Hi,
Hope your DB name is “wordpress”
Change the,
– Database: `wordpress`
–
CREATE DATABASE IF NOT EXISTS `wordpress` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
change “wordpress” to your live DB name. It’s at your sql file.
qs says
I checked and all the privileges are already set to “yes”.
is it because of the “latin1_swedish_ci” collation in my database? because the rest of the tables are all in “utf8_general_ci”
qs says
I checked and all the privileges are already set to “yes”.
is it because of the “latin1_swedish_ci” collation in my database? because the rest of the tables are all in “utf8_general_ci”
fab says
hi there,
totally newbie here. hope you can help with this error message during step 4:
Error
SQL query:
—
— Database: `information_schema`CREATE DATABASE `information_schema` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
MySQL said:
#1044 – Access denied for user ‘renta730’@’localhost’ to database ‘information_schema’
When setting this user I allowed all privileges to the database previously created (named “inicial”).
Any thoughts?
WPBeginner Support says
You are not supposed to install WordPress in the database information_schema. Create a new database for your WordPress site, and continue from the step 4.
Administrador
neha says
Hi,Nice tute,but can u plz tell how to change database name and password etc from wordpress from live server?
WPBeginner Support says
To change database username and password connect to your live website using an FTP client. Find wp-config.php file and edit it. You will see your database name, database username, and host information. Change it to the database information for your live site.
Administrador
Kerry O'Connor says
I’ve tried every variation of my ‘host url’ in the wp.config file and uploaded it every time, no avail, still getting ‘Error Establishing db..’
Where before it was ‘localhost’, now it should be ‘mywebsite.com’, is that right?
thanks
WPBeginner Support says
For
MySQL hostname
, localhost works fine for most user. However, if you don’t know your database host, then you can ask your web hosting provider.Manish Patel says
Good Explanation.We can easily setup from this tutorial.Nice Post.I have helpful it.
Mohammadreza says
Best ever, I really appreciate your clear explanation. you’ve got your new follower for sure![:)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Changdeo Mhaske says
Thank You,
would only make sense if this is a new site. If it is an existing site, then you would have to constantly comment out the hosts file in order to access the live site.
Justin Esparza says
Thank you very much for this clear concise how-to. It helped immensely. You have a new follower.
Satyanarayana says
Hi Dude.
Actually i followed the process as you explaned above is very nice and clear.
but i was getting the error “page not found”. when i click on link in a website
i am changing my files from main server to localserver
Can you please help
Carol says
New to WP and completely lost. But I managed my first migration thanks to this article.
Thank you! Thank you!
Steve says
As a beginner, I found this article very helpful, but couldn’t get my site up live after developing locally. Everything was fine until Step 6. I did see the Error Establishing Database Connection error, and then edited the wp-config.php file. However, my site became a blank screen at that stage and I haven’t been able to change it.
I continued on and went to my WordPress admin panel, and checked Settings » General. They still showed the localhost web address so I changed it to my site url. This is when things turned ugly. I was automatically logged out of WordPress and can’t get back in. In fact, when I ask WordPress to email me a new password to log in, its sends a localhost URL that takes me to a sign-on page with a message that reads “Sorry, that key does not appear to be valid.” I have no idea what caused that.
Any help would be greatly appreciated.
WPBeginner Support says
Open your database in phpMyAdmin as mentioned in Step 5 and make sure that in wp_options table, your site url and home url options point to your live website.
Administrador
Steve says
Thanks for your suggestion. I double-checked and yes I had completed that step. Both have the correct URL
Part of my confusion is that I now have two databases for this website. I originally had one accessible through a URL that starts with the number of an IP Address/phpmyadmin. Then I have the one I created in Step 3, which I did through my hosting company’s e-panel. They have different passwords and names. But I’ve tried both combinations in the wp-config file and still get the blank screen. Which one of these databases should I be using? They seem to have identical content.
Patrick says
Sparky!
Your step-by-step guide was spot on. I am a mac user, and after MAMP, I am live now. Thanks a lot. It worked perfectly for me.
Hat docked!
Vishal Kumar says
I have done migration form live site to localhost successfully. But I noticed that Comment facility is not there after this. I have also checked all the option in ‘Setting->Discussion’ page. Everything is cheked but Commenting option and Leave comment box is not visible anywhere in the localhost. Please give me any suggestion for this because I am new in wordpress I am a Zend framework developer basically.
WPBeginner Support says
Did you check comments template? Ity is usually comments.php file in your theme.
Administrador
NARESH says
Instead of moving the wordpress site, I would like to fresh install wordpress using fantastico or hostgator’s quick install, so will I be able to do like this too just by exporting and importing databases and uploading the themefiles? or this is the only way we can do it?
I don’t know why. my local machine wordpress loads very slow than one, whichever is installed on live server using fantastico or quick install.
WPBeginner Support says
Naresh yes you can import your posts and comments using import/export tools in WordPress, then you can upload theme and other files using FTP. There are multiple ways to do things you need to choose one that works best for you.
Administrador
Siddharth Khare says
Best Explanation Ever. I was able to set up in a mere 5-10 mins
Editorial Staff says
Thanks Siddharth.
Administrador
Mark Jones says
Do all of these instructions remain the same if there’s already an older, existing, non-wordpress page built where you want to move your wordpress page? For instance, rebuilding an existing site as a wordpress site, then switching over.
Editorial Staff says
Yes because in theory, you will be overriding everything that is there.
Administrador
Erwin says
Best way (IMO) to change the URL in the database is via the Search and Replace tool of Interconnect it > http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Editorial Staff says
Thanks for leaving a comment Erwin. Yes, some others have recommended that tool as well in the comments.
Administrador
Abrishca says
It’s easy to forget just how much work a good plugin really does for us – I personally use the Duplicator plugin to transfer new websites from my development server to the client’s domain and you can see how much time this plugin (and Backup Buddy) can save you.
Editorial Staff says
Totally agreed with you there![:)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_smile.gif)
Administrador
Praveen says
Hi,
I am facing problem in changing the database after creating the new database.
Is there any problem with my hosting service or anything else
Iskandar Dzulkarnain says
thanks, your tutorial is solution for my problem
Anna says
Are you reading my mind?! Just a little while back I sat down at the computer to figure out how to add a Facebook like button to my first website, currently in development. Whala! “How to add a Facebook like button to your posts” was that day’s article. Then I’m wondering how to begin the local to live migration today, and AGAIN, here’s this post! GET OUT OF MY HEAD!![:)](https://www.wpbeginner.com/pt/wp-content/plugins/classic-smilies/img/icon_smile.gif)
And seriously, thank you very much for the invaluable help you’ve given to a beginner like myself.
Editorial Staff says
Haha the little birdie told us that you needed this article
Glad to be able to help.
Administrador
Jean says
Nice tutorial, thanks.
riaz ali shah says
great article, the technique i often use for develop wordpress sites for clients, i use dummy text and images for local and then i move my theme only on server.
John Coleman says
This was a great article. Another option to address the broken links issue is to do a find/replace on your .sql file (in a text editor) of the local URL to the production URL before you import it. This is also handy when moving a site to/from a sub-directory, or to push from staging (e.g. http://staging.domain.com) to production (e.g. http://www.domain.com).
Thanks for putting this out there. I am sure it will help a lot of people.
David says
Could have used this article 20 months ago. The trick I discovered in making the move was to open the database file in a good text editor. From there I did a search & replace maneuver to change localhost to the proper URL. It discovered numerous instances without me tracking down the tables, or worrying if my command syntax was correct.
There’s a plugin called Broken Link Checker that’s worth running as well after the move.
There are some web-hosting sites who’s infrastructure keeps everything in your WordPress site as localhost. No need to change anything in your local build. Just copy it over. Will definitely chose one of them next time.
Mark says
2 suggestions to make it easier to move:
1. When developing locally edit your HOSTS file (c:\Windows\System32\Drivers\etc\hosts) to point your domain name at local server. This avoids having to change the SITE URL and other links/images. Note: this will require config changes to your local web server.
2. If you have to modify the SITE URL etc, after you have exported the local database and before import, Open the file in notepad and search for all instances of localhost/yourtestsite and replace with http://www.yourlivesite.com
Editorial Staff says
Mark,
1. would only make sense if this is a new site. If it is an existing site, then you would have to constantly comment out the hosts file in order to access the live site.
2. Yes that would make sense.
Administrador
Mark says
Changing the hosts file is something I do quite often and have a shortcut on my desktop giving me quick access.
Gregg says
I also recommend DeskTop Server which I have been using for more then a year. Desktop Server allows you to create a local version of your site and then direct deploy it. Awesome!
Sü Smith says
Great post! I typically just do find and replace on the .sql file with Notepad++ before uploading it to phpmyadmin. This is a nice alternative.
Mike Ott says
Unfortunately this only works for some sites. A lot of wordpress plugins store serialised data in the database (Gravity Forms is one such plugin), and serialised data isn’t portable so doing an SQL dump and importing via PHPMyAdmin won’t work properly because of the string length differences between your local URL and live domain. You can’t even run an SQL query over serialised data.
The best thing I’ve found to get around this problem is by using the WP Migrate DB plugin (http://wordpress.org/plugins/wp-migrate-db/). It handles the serialised data problem flawlessly every time and you won’t have to do half the other things you mentioned in this post.
Have fun.
Mark says
Just had a light bulb moment! I have run into this issue before, thanks for the heads up Mike and pointer to the plugin,
Augustas says
For replacing paths and URLs I always use “Search and Replace” tool ( http://goo.gl/MCsKl ). It replaces serialized data, and it can be used for other CMSs as well, not only for WordPress.
estudiowp says
Nice article an well explained steps!
However, many people will find troubles in their migrations because of the serialized data.
Some plugins and themes use serialized data, and the replaces in step 5 and step 7 won´t change all the urls and paths that need to be changeed.
For those steps you could use these tools or plugins:
· wp migrate db plugin: http://wordpress.org/plugins/wp-migrate-db/
· search and replace tool: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
I hope this comment will be useful and sorry for my english!
RW says
awesome post! I could have used this with my first local > server migration!
Jean says
Great article – best I’ve read on this subject.
I moved a site a while back and the only thing I would add is that you might need to re-save the permalinks settings. I had to do this because none of my menu links worked so this was an easy fix (luckily!)
Editorial Staff says
Good suggestion. Added that to the article.
Administrador
Mike Ott says
If anyone wants to know what that happens, it’s the .htaccess file shows a different RewriteRule between local and live.
A quick edit to .htaccess fixes the problem or as Jean pointed out, re-saving the permalinks settings will also do the trick as it’s just fixing the RewriteRule.