Hi

I'm stuck with the database .

How can I built the databse on localhost and import the databse file into it?

Thanks

Comments

vm’s picture

export the database using a tool on your server like phpmyadmin
import the file that was exported into the new database

transfer the files from the server to the localmachine

change settings.php to point to the new database $db_url

e2’s picture

import the file that was exported into the new database

How to built the databse ?
How to import the file?

???

vm’s picture

on your localmachine you create a new database in MySQL.

You have installed Linux, Apache, MySQL and PHP on your localmachine yes? using a package like WAMP or Apache2triad ? or another if you prefer?

you import the expoprted file using the tools available to you. You should read up on how to work with phpMyadmin if that is the tool you are using. This isn't specific to Drupal. It's specific to how to work with your databases and is dependant on what tools you are already using or are planning to use.

If you don't have a server environment on your localmachine, drupal won't run.

Before you can go any further, you should take the time to mention which package you are using for a server environment on your localmachine.? WAMP?

e2’s picture

I have apache installed and run.

I have the drupal book and it is writing this:

to create the databse:

$ mysqladmin -u db_user -p create db_name

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

create new user

$ mysql -u root -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,LOCK TABLES ON db_name.* TO 'db_user'@'localhost' IDENTIFIED BY 'password' ;

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

import the database scheme

mysql -u db_user -p db_name < database/database.mysql

vm’s picture

Using example in the book would require you to work from the command line.

You can use the example in the book, or use phpmyadmin or similar tool provided by your setup. In most cases it's phpmyadmin which should also be installed in your environment.

apache is only one part of what you need. As previously stated, Linux, Apache, MySQL and PHP need to be installed. Apache alone won't provide all the tools you need.

e2’s picture

took me 10 minutes.

I imported the mysql shema

what now?

vm’s picture

move your files as previously guided
adjust settings.php as previously guided

e2’s picture

that is the problem, i dont know how.

"change settings.php to point to the new database $db_url "

the file I imported is - database.4.1.mysql

what should i write in the $DB_URL ?

vm’s picture

look at the current $db_url line

get a copy of a fresh settings.php and look at a $db_url in that

I can't tell you what to put in the db_url because I do not know your Database name, Database password nor datbase location. location is more than likely localhost.

only you know the DB name DB username and DB password.

e2’s picture

but how does it know where in localhost?

vm’s picture

localhost is a location ON your LOCALMACHINE.

you keep using the word localhost where you should be using localmachine.

you are installing drupal on your localmachine.
your database is located at your localhost

e2’s picture

phpmyadmin just tells :create database but not to enter the password for it.

where to enter password?

can't find it phpmyadmin manual.

what am i missing here?

e2’s picture

but drupal needs to know where on my local machine.
i don't get here somthing

how to do it?

vm’s picture

again, the location for drupal to know where the database is , is localhost. as your localmachine has the DB located at localhost.

I suggest using google to find more information on how to work with the tools you are using. Once you learn to use the tools and understand the vocabulary you will be in a better position to do what you ask.

e2’s picture

when someone is opening a file from a remote machine it gives a path.

where is that path to the database?

e2’s picture

Unable to select database

We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.

The MySQL error was: Incorrect database name 'home/database.4.1.mysql'.

Currently, the database is home/database.4.1.mysql. The username is eranb2 and the database server is localhost.

* Are you sure you have the correct database name?
* Are you sure the database exists?
* Are you sure the username has permission to access the database?
---------------------------

how does he know that the database is in /home directory ?

i didn't tell him that.

how can i solve that problem ?

e2’s picture

the file name is drbase.sql

but in the setting.php file the file must be written drbase .

no .sql

but still , drupal somehow know by it self where the database file is located, how?
also, write only localhost and not localhost/home/drbase.sql

it is working

thanks !!!

m_i_c_h_a_e_l’s picture

VM,

I have a question for you.

Would it make sense to copy my installation from the webserver to my local machine for use as my sandbox?

I know I should have done it the other way around, but now that I have a good installation on the webserver, which I am happy with, I just need a way to test minor mods before I add them to the live installation.

vm’s picture

sanbox site = testing so sure.

However, if you work on something and you want to do it on the production site you may need to take a current snapshot of the production site after it is set to offline so that you can make the changes to a current database and not a moving target.