Hi there,

Sorry if that issue’s already been raised in the past. I’ve read quite a lot about the Drupal database over the past few days but I’m still completely lost. I also had a look at the forum but can’t find the answer to my questions.

The person who set up Drupal on our site is gone and our hosting company couldn’t answer my questions. I need to find the Drupal database as some of the content will now need to be managed with Mysql, not Drupal, to include some feeds we’re buying from an external company.

Anyway, here are the questions:

1) Where is the Drupal database? I found some info on our server under sites/defaults/setting but when I search all databases availbale on our server, the databases I find do not include the info I am looking for. Which leads me to my second question.

2) How do you call the Drupal database? Can you use Mysql?

I’m sorry for asking basic questions but my knowledge of Drupal is simply non existent and I have no idea where to start looking…

Thanks,
Emilie

Comments

cog.rusty’s picture

1. The database name, database user, database user password, and database server name are in the $db_url line in the sites/default/settings.php file (or in a sites/example.com/settings.php file, if it is a Drupal multisite).

2. Yes, you can access it either with command line mysql or with phpmyadmin if you have it installed, and you can run any SQL queries you want.

The content is in the node_revisions table.

SamuelFreeman’s picture

You need to use software like phpmyadmin through cPanel to access the database. It's not a file stored in your /public_html/.

Once you have access to the database you can run this query to give you back admin access: update users set pass=md5('NEWPASS') where uid = 1;

Just change NEWPASS to your preferred password, then go to www.yoursite.com/user and login with admin and the password you set.

yelvington’s picture

This has all the earmarks of an episode that will end badly. I don't mean to be rude, just cautionary: If you have to ask questions like this, you are not sufficiently skilled to be touching the database directly.

There is very rarely any justification for directly interacting with the database. Drupal provides an API and high-level functionality for storing and retrieving node content. Authors of contrib modules have created tools for importing delimited data and XML in many common formats. You should exhaust all of those avenues before you consider directly interacting with the database, and if you do, you should first have a thorough understanding of where and how Drupal stores data.

emilie6709’s picture

Not to worry, you’re not rude in the slightest. “Why?” is the first thing I thought about when I was told I had to find the database not knowing a thing about Drupal! We’re a small company and my boss thought it would be pretty simple to figure it out while I knew full well that it wouldn’t be.

In the end I just came back to my initial conclusion: This is just not a good idea!

Thank you all for your help anyway.

Emilie

melle27’s picture

Hi,

I'm having a similar problem, and don't want to fiddle with source code I don't understand.

While learning Drupal and playing with re-theming, I stupidly started working on content. After copying the Drupal folder to another directory, I can't access admin or "Home" link (url.../node13) and get this error:
The requested URL /drupal/node was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

-I downloaded a program to show my .htaccess file but still can't access the file
-Some Drupal folders and files had gone missing
-After deleting the copied folder I downloaded a new version of Drupal to another directory, and moved the known missing files and folders to the old drupal folder
-I use cPanel and downloaded Drupal via Fantastico

I don't care about the layout or styles, which I think I've deleted anyway. I just want my content back, even if I can somehow extract it from the database to copy or export. The footer and under construction message are still showing - so I assume the database is still intact somewhere.

Thanks so much for taking the time, if you can.

ryivhnn’s picture

You should probably start your own topic, your problem sounds different from OP's :)

I don't trust Fantastico, only ever heard dramas surrounding it. Unless you also deleted the database all your content should be fine. Use ftp and install a fresh copy of Drupal, stick your theme back in where it was (otherwise it might whinge if you didn't set a different theme before deleting the one you were using), edit /sites/default/settings.php, find the $db_url line and edit to enter your database username and password.

works at bekandloz | plays at technonaturalist

ryivhnn’s picture

You should probably start your own topic, your problem sounds different from OP's :) (not to mention it's from last year)

I don't trust Fantastico, only ever heard dramas surrounding it. Unless you also deleted the database all your content should be fine. Use ftp and install a fresh copy of Drupal, stick your theme back in where it was (otherwise it might whinge if you didn't set a different theme before deleting the one you were using), edit /sites/default/settings.php, find the $db_url line and edit to enter your database username and password.

works at bekandloz | plays at technonaturalist

melle27’s picture

Thanks so much for your answer ryivhnn.

I'm looking forward to deleting the current Drupal version and having a fresh installation.
I'll follow some tuts to download via FTP.
I didn't actually delete the theme - just deleted the changed copy. But I'm not sure how Drupal was keeping track of which files were connected to my site with all the copying, moving, duplication and deleting going on.

Would you recommend installing the fresh copy with the remaining drupal files where they are? Or should I move all the current files to a dummy folder ready to delete later?
I'm also a bit confused about the database. When I reinstall I will have a new and presumably empty database. How do I get the old database into the new Drupal installation?

Thanks again for your help.

ryivhnn’s picture

urls are relevant to whatever the root folder is. If you're using it on a live site, it would be /public_html/ usually, on my dev environment it's /Sites/[insert-project-name-here]. It could also be in a subdirectory for example /public_html/drupal.

Because the links are relative, if you move stuff around, it can't find things it was looking for. So say you had it in /public_html/, you would have a link being constructed as /link-to-file. The leading / makes it go to the root directory /public_html. If you set it up in a directory or moved it to a directory it would still be looking from /, but if there's a directory in the way (you need it to be /public_html/drupal/link-to-file) you would need to edit the RewriteBase line in the .htaccess so that it reads the base path from the directory it's in rather than the highest level directory it can get to.

If you're only replacing the files and haven't deleted the database itself, it won't bother reinstalling the database. When you change the username and password in the settings.php to whatever you set it to when you installed it the first time, it will use the database you made with the first Drupal and not reinstall it.

Clear as mud? :)

Also, I don't know what you're playing on but highly recommend it be a server set up on your own computer not with a live site.

works at bekandloz | plays at technonaturalist

Bigdigits’s picture

Hi, I concur that fiddling with a database might be disastrous. However, it is necessary for me to know where it is. I have access to Msql administration php myadmin.

I'm doing this site on a localhost. My worry is that after hustling through to the completion, I might not find the database so as to transfer the site.

I'm working with drupal 7 on an appserv localhost
During the installation, it could only fine sqlite... (I didn't quite understand this part but there was \includes\database\sqlite... selected)
The site installed successfully and 'everything' is running
I'm at a loss where the database is in phpmyadmin so as to later export it and import it in the transfer process
I'm used to joomla and wordpress systems and can see the databases created by those installations

Regards

wightowl’s picture

My database appears to be on the local (Windows) path:
"C:\Program Files (x86)\DevDesktop\mysql\data\drupal_8"

However, this is specific to my usage of Acquia Dev Desktop 2 with Drupal 8.0.2 and the Drupal 8 Beginner series of tutorial videos.

After updating to 8.0.3 the system insisted I perform a 'Drupal database update' suggesting 'Back up your database' before continuing. I am not sure why this must be done manually instead of the program doing it in a few clicks. A bump in the learning curve for beginners. The Drupal 8 Beginner video series is excellent. It's rather like a flat learning curve with the suspicion there's a vertical cliff face somewhere ahead!

mic dilpo’s picture

thanks for sharing