Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-08-20 14:49:22

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

database and mysql importing

Hi everyone, I’m trying to load a local site for testing. I’ve successfully installed XAMPP and exported the sql file using the MYSQL interface at my site.

Here’s the problem. I keep getting this error:

MySQL said: Documentation
  1. - No database selected

- I’ve Googled it and found two suggestions, neither of which work (more error messages). The suggestions are add these lines 1) at the top of the document (which I did) and 2) before the first CREATE TABLE command (which I did). Here’s the code:

CREATE DATABASE name;
USE name;

- I’m completely out of my depth here; I’m just guessing.

Last edited by jameslomax (2018-08-20 14:50:05)

Offline

#2 2018-08-20 20:54:40

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: database and mysql importing

Hi James,

I’m not quite sure from your description which bit is not working, but if you’re trying to download your live public site and make a test installation on your own computer where you have XAMPP installed, then you shouldn’t need to get into the nitty-gritty of mySQL commands, but can us phpmyAdmin, which will likely exist on your online server and in XAMPP. The basic principle is:

Exporting the database from your live site:

  • Log into your webhost’s control panel. Somewhere in there you’ll have an option called “phpmyAdmin” or “databases” or similar. You may have to choose the database you want to open first, or you may have to start phpmyadmin and then choose you database from the list in the left-hand column.
  • You should then see the structure of the database on the main section of the page in the tab called “structure”.
  • Now switch to the tab at the top of the screen called “export”, switch to “custom”, verify that everything is ticked in the “tables” list, and where it says “output”, click on “save output in file” and utf-8 and compression: none and then click “OK” at the bottom. A .sql file with the name of the database will be saved to your computer.
  • You can now close your host’s phpmyadmin.

On your computer:

  • Start XAMPP using \xampp\xampp_start.exe and verify that mysql has also started.
  • Open your browser and enter http://localhost/ or http://127.0.0.1/ as the address.
  • You should see the XAMPP start page, as shown below.

  • Click on the button “phpmyadmin” on the top menu bar. That should start phpmyadmin.
  • Click on the “home” symbol at the very top left and the panel on the right should switch to “General settings”. Now click on the first tab called “Databases”
  • Where it says “Create new database” enter a name for your database (tip: keep it simple and lowercase) and choose utf8_general_ci as collation and then click “create”.
  • I ‘think’ that database should now be selected, but if not, choose it in the list on the left-hand side.
  • On the right-hand panel, click the tab “import” and then “Choose file”. Locate the file you downloaded in the above step, then set or keep the character encoding as “utf-8”, format as “SQL” (both probably preset) and then click “OK”. The database should be imported.
  • Now when you click the database name on the left-hand side, you should see the tab “structure” and the list of tables.

That’s how you transfer the database. At present it is a simple mirror of what you had on your online site. You’ll need to change some of the preferences settings to get it working on your computer.

Now you need to download your Textpattern installation files from your online host using an FTP program to a folder inside \xampp\htdocs. Once you have that, make a safety copy of the file /textpattern/config.php (e.g. config.online-host) and then edit the original file. You’ll need to change your database name to match the one on your computer, the user (probably “root”) and the password to whatever you set when you installed XAMPP. You’ll also need to edit the txpath to match your windows/mac path to the textpattern folder. After that you should be able to start textpattern by entering http://localhost/your-folder/textpattern/ in your browser. Sign in and go the Admin › Preferences tab. You’ll need to change your preferences to match those you’re using on your computer.

That was really a very quick run-down (especially the last part). More details here. If you end up with a lot of errors, your php version in XAMPP may be higher than what you have for your online server. Check your diagnostics panel on your online site to find out what you’re using online, then change your settings in XAMPP to match (as far as possible).


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB