MyBB Community Forums

Full Version: MyBB New Host & New Errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
First I hope I am in the correct forum for this level of problem I am having with MyBB.

Situation: Need to relocate MyBB forum from one host to a new hosting service with Sql Database intact.

I will go over what was done step by step so if I did something terribly wrong or just missing something simple hopefully it stand out to the more saavy MyBB users.

I am new to MyBB and I found this guide on how to do this at http://community.mybb.com/thread-27771-page-1.html

Following the steps presented here my first issue was that the /inc/settings.php did not have the $config lines anywhere in the code. So I added them in the file with the correct database settings for the new host & datadbase location.

Logged into my new host's admin panel and went into the phpmyadmin menus. Went to the SQL tab and selected the backup file I created in the first step and after clicking "GO" a few seconds pass and I receive an error:

Error
SQL query:

-- MyBB Database Backup
-- Generated: 20th December 2012 at 14:18
-- -------------------------------------
CREATETABLEmybb_adminlog (

uid int( 10)unsigned NOTNULL DEFAULT'0',
ipaddress varchar( 50)NOTNULL DEFAULT'',
dateline bigint( 30)NOTNULL DEFAULT'0',
module varchar( 50)NOTNULL DEFAULT'',
action varchar( 50)NOTNULL DEFAULT'',
data text NOTNULL ,
KEYmodule (module ,action)
) ENGINE=MYISAMDEFAULT CHARSET= utf8


MySQL said:
#1050 - Table 'mybb_adminlog' already exists

----------------------------

I am not sure how this could already exist since it was the first time the file was uploaded (and any file since the new database's creation). However there could be other issues I am not aware about that may also cause this error.

If I try to view the forum, it displays a MySql error which is probably due to the database not properly uploading.

Any Ideas on what I am missing or doing wrong? All I want to do is simply move hosts for MyBB forum.

Thank you.
Moving sql database :

To save your database from old forum :
- Goto phpmyadmin in old server,
- Chose 'databases' tab then chose your database name
- Chose 'export' tab (you will see : Exporting tables from "xxxx" database)
- Chose 'Custom - display all possible options'
- You will see all tables selected (if not, chose 'select all')
- Set compression to 'gzip' (if its not set by default)
- Click 'go' and you will get database file.

To upload your previously saved database to new server :
- Goto phpmyadmin in new server,
- Chose 'databases' tab then chose your database name (or create one if you dont have it yet)
- (if you have any old mybb tables in this database - delete them all, it must have no tables)
- Click 'import' and you will see Importing into the database "xxxx"
- Chose 'Browse your computer' to chose previously saved file.
- Click 'Go' at bottom of page.

Thats it.
TIP : If you will have to create new database and wonder which 'collation' to chose, it will be utf8_general_ci

Moving files :

- Download all files from FTP to your computer.
- Upload all files to new server FTP
- In new server open file 'config.php' which is inside of 'inc' folder.
(TIP : you have to open it with correct editor, notepad++ can be one, else file may broke.)
- Update following fields in this file to fit new server settings.
(this is important, else your site will not work at all)
$config['database']['type'] = 'xxxxx';
$config['database']['database'] = 'xxxxxx';
$config['database']['table_prefix'] = 'xxxx_';
$config['database']['hostname'] = 'xxxxx';
$config['database']['username'] = 'xxxx';
$config['database']['password'] = 'xxxxxxx';
- Open 'settings.php' file the same way as you did with 'config.php' file.
- Update these lines in 'config.php' file to fit your new server :
(this is important, else you may have trouble login to your site)
$settings['bburl'] = "xxxx";
$settings['cookiedomain'] = ".xxxxxx";
$settings['cookiepath'] = "/";
$settings['cookieprefix'] = "";
$settings['homeurl'] = "/";
- When you succesfuly login, go to ACP, fix rest of settings and save.
The problem here is that I am using MyBB for the old database, the CP for that does not have the phpmyadmin style. I have to work with the MyBB admin CP to copy the database.

I can follow the other guide's instructions to navigate with your instructions with no problem. However a problem that still occurs (even after removing all the forum folder files and leaving only the DB) is that SQL query error when trying to upload the backed up files on phpmyadmin on the new host. This is with all the options you suggested (which were selected using the MyBB backup).
issue was that the /inc/settings.php did not have the $config lines anywhere in the code. So I added them in the file with the correct database settings for the new host & datadbase location.
It looks like you have mistaken files and trying to put database things in settings.php while you should in config.php, at the same time your forum use old database because old settings are still unchanged in config.php and points to old one.

Look again :

This have to be in config.php
$config['database']['type'] = 'xxxxx';
$config['database']['database'] = 'xxxxxx';
$config['database']['table_prefix'] = 'xxxx_';
$config['database']['hostname'] = 'xxxxx';
$config['database']['username'] = 'xxxx';
$config['database']['password'] = 'xxxxxxx'; 

This have to be in settings.php
$settings['bburl'] = "xxxx";
$settings['cookiedomain'] = ".xxxxxx";
$settings['cookiepath'] = "/";
$settings['cookieprefix'] = "";
$settings['homeurl'] = "/"; 
I saw that with your post. However I am not at that step yet as your replay suggests I should be able to at least upload the DB Tables on the new host which It seems is not able to happen with the SQL query errors from just uploading per your instructions for phpmyadmin.
You seem to have database queries constructed the way that not take into consideration that tables may allready exsist, so if they exsist, it simply give error.

My instructions take that into account and was exacly made the way to avoid this situation.
What i told you was : make database manualy in phpmyadmin, make sure there are no tables,
then upload database and if it try to create tables - there will be no tables at this time in database
so it will succed to create these tables and will proceed without error.
And this is simpliest method or you want to fix sql syntax in xxxx gigabyte text file with thousands lines ?
Ok I seem to have the issues fixed. Like you said there were still some conflicting tables present. After dropping everything on the phpmyadmin DB I was able to upload without issue. After that editing the two files you pointed out worked like a charm. Thank you.