2

I became in charge of a legacy website, which was written by someone else that is now not available, and has no CMS - just pure php and html. It's not written very well, but that's my problem...

Some of the content is stored in a mysql db on localhost. I want to access that db and retrieve all the data so that I can rewrite the whole site, with the existing content.

Is there a way to do so? I have the credentials to the mysql db (I found them buried in one of the php files), and I tried to access it thorough phpmyadmin, following this technique, but the server refuses my connection ("access denied"). I suspect the problem might be that I simply replaced the localhost in the credentials by the site's url. Any advice will be very welcome.

yohbs
  • 123
  • 3

3 Answers3

1

Mysql-server might be locked down so only localhost can access is allowed for that user.

Try using ssh and connecting locally to see if your user can login using the mysql client on the box. somthing like this should let you connect and then see what users are setup and from where they can connect.

mysql -u -p

select * from mysql.user\G

Also worth checking port 3306 is open on your firewall.

jsmith
  • 26
  • 1
1

Are you able to access the site via SSH? (port 22 using PuTTY, etc). If so, you can tunnel to the mysql db using this guide. The instructions in the text are for Mac OS Terminal (this approach is pretty version-independent), and there's a link to how to do with PuTTY on Windows at the bottom of the page.

If you can't access using SSH, you may consider two approaches:

  1. Site's URL might not be the same as the hostiing server name. For instance, www.foo.com may not be called foo.com. You might have to directly access the hosting server. To elaborate on this we would need details of your hosting setup.

  2. Your ISP might use a control panel or a non-standard port for MySQL to discourage hacking. You could contact the hosting company (or the person who pays the bills might) for further assistance.

lonstar
  • 139
  • 3
1

MySQL has its own privileges scheme.

The best thing to do is to login to MySQL from the command line and create a new account for use with your PHPMyAdmin.

Otherwise, take a backup via the command line and do your new development on a totally new server restored from the backup.

dmourati
  • 25,540
  • 2
  • 42
  • 72