Access Joomla Database - mysql

I'm trying to move a joomla site from one person's hosting account to another. Thus I'm really limited in which tools I have.
The problem I'm having to trying to get access to the mysql database. I don't have access to ssh, cpanel, phpmyadmin, or anything else of the nature, just joomla admin and ftp access.
However joomla gives me some database settings.
But when I try to connect to the given hostname, nothing happens.
I'm trying something like and it just hangs
mysql -u myusername -h thegivendomain.db.3456321.hostedresource.com jos_giventable name
I even tried digging the hostname and tried using the ip for the hostname.
and ideas?

It is reasonable to assume that their firewall just blocks remote access to the MySQL service, so your attempts to connect don't reach their destination.
Seeing how you are familiar with shell in general, you could try a PHP shell wrapper, such as this one I made for myself - if the hosting company is not too uptight about their security, this script will be able to run shell commands, e.g. mysqldump -uusername -ppassword db > backup.sql.

Install the free Akeeba Backup it will make a complete copy of the website that you can download. Upload that to the new server and install with their Kickstart script.
Run Kickstart from any browser on the new host and follow the steps.

Related

Automated download of whole mysql database without mysqldump

On my shared webhost, I have very limited ssh access (only via imscp instantSSH plugin). I want to set up a script to download my whole mysql database as an sql file, but I cant figure it out.
I cant use mysqldump so I tried the mysql command, which is available, but it isn working.
I have to specify username, password, host and database, and my password contains special characters.
Anyone can help me?
If your shared host allow mysql remote connections then you can use any MySQL software to connect to the database and then extract whatever information you need. Tools like these are: HeidiSQL, NavicatGui etc.
Another way would be the one suggested by Akshay Khale.
A 3rd one would be to use phpMyAdmin (most shared web hosting have this installed by default).
A 4th one would to create a simple php script that runs mysqldump locally, saves the .sql dump file either locally on your shared hosting or remotely via FTP/SFTP or any other protocal. Also the same script can email you that file (inline or as an attachment to the email). This kind of automation can be configured using a cron job.
There are multiple ways to achieve this. It all depends on which one suits you best.
As the author of the InstantSSH plugin for i-MSCP, I can say you that you should ask your HPs to make the mysqldump command available from your chrooted shell. The host administrator can add any command to the chroot by editing the InstantSSH plugin configuration file.

Automate Putty To Do Daily Task

I am fairly new to putty, need your help guys I would repeatedly connect to a linux server using putty almost everyday then connect to one more linux sever from within previous linux server as it contains database, then login to mysql and take a database back up
I want to automate this process by creating a bat file as am on windows 7, i was able to login to putty and then to mysql, but console disappears after that
login to putty with username password
ssh to another server and login with username password
login to mysql then take a db back up using mysql dump
copy the db backup file to desktop
Thanks in advance
When your goal is making the backup, you do not need to automate Putty. You can make a unix script that will call mysql and make a backup. When that script works, you can add it to crontab (Unix scheduler), so it will run every day.
You need some more testing before crontab works well: your environment in an interactiv session will be different.
Edit: Did not answer the last part:
And 4. copy the db backup file to desktop
There are different ways for transporting the backup. You can have a mounted drive, shared directory, or use some transport protocol like rsync or scp. I can not tell which fits best in your situation.

old web host doesn't have phpmyadmin, remote access?

A new client of mine has a site hosted on netnation (boo). Their account manager doesn't have a way to access phpmyadmin or anyway to access the database. I'm not a programer, I'd just like to be able to view a stored password so I can give it to my client. I have the database host, user, password, and database name in the php files of the site.
Is there a program that I can use to view the database? No command line please it's not my thing and I'd probably break something.
Thanks
Most live databases don't allow direct access from outside the server, so if you're unlucky it can't work unless you can configure mysql to allow access from remote clients, too.
But at least you can try. Just configure any phpmyadmin installation (locally or on another server) to connect to that database. You do that in the file config.inc.php in the phpmyadmin root directory.
Look for the line that says "$cfg['Servers'][$i]['host'] = 'localhost';". Just replace 'localhost' with the url or IP your database is running (usually the same as the website). If your mysql allows remote access, you should be good to go. Otherwise you will have to re-configure your mysql installation first to allow that.
MySQL Workbench is a GUI program that allows access to MySQL database. It can work directly or using SSH. Most likely you won't be able to connect directly so your best chance is to get SSH access and connect using it. If it's not an option you can get FTP access and install phpMyAdmin (simply by uploading it to server).
Also, it's considered a bad practice to store password in DB, so it's very likely that the password itself is not stored, just its hash.

export large database mysql phpmyadmin

I am using phpmyadmin on my windows os. I have a database with one table which has 100M records with the size of 20GB. I want to export this table and have the table.sql file. Whenever I try to do this, the size of the exported file is 0 bytes. When I check the apache error log, the following would show up:
Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1066139648 bytes)
Any idea how to solve this problem?!
Thanks :)
I would suggest to try using the command line and the mysqldump.exe utility, as suggested here
If you have shared hosting and you are using Cpanel then they are providing you the option to backup your database in the following section.
Files => Backup => Download a MySQL Database Backup.
If you are on a shared hosting or you don't have access to shell, then use mysqldumper script; copy it to your server and start it in your browser under "yourDomain.com/path_to_mysqlumper/"
MySQLDumper is a PHP and Perl based tool for backing up MySQL
databases. You can easily dump your data into a backup file and - if
needed - restore it. It is especially suited for shared hosting
webspaces, where you don't have shell access.
If you have shell access to your host servers (if provided by your host since not all shared server hosters give this access) then you may use SSH access like in this tutorial using Putty that you install and configure then import or export your databases like in this third tutorial.
I try mysqldump for many hours but didnt work, until I started a superuser console.
First, start a superuser console
sudo su
Then, try the complete command
/opt/lampp/bin/mysqldump -u root -p [DATABASE NAME] > [PATH_FOR_BACKUPFILE]/[FILE_NAME].sql
I my case, it was something like /opt/lampp/bin/mysqldump -u root -p database > /home/user/backup.sql
MySQLDumper worked like a charm for me at my hosted website. I had to copy one database and "paste" it into a new database. In MySQLDumper, it isn't apparent right away how to do this, but the key is to create a new configuration file in MySQLDumper and that will allow you to copy/restore to different databases.
On the home screen in MySQLDumper, click Configuration, then Configuration Files. There is a text box at the top allowing you to create a new Configuration file. In there, put in the information for the second database you need (you created a connection to the first database when you install MySQLDumper). Save it. Then you can click Restore where you can select the dump of the first database and restore it in the second one.
This was a lifesaver. Thanks!
increase
max_post_size
variable in php.ini file. Then you will be able to download it.
I had a different issue when I was downloading from phpmyadmin in the middle like 180MB download stops with message - network error
So I used ssh connection which you can find in your cpanel sometimes they provide browser based terminal or sometime you have to access it using putty .
In terminal I go inside my public_html folder where all my files are stored . Followed by this command:
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]
This did the job in few minutes and saved a sql file in my public_html folder. Then I opened the folder in File manager and downloaded it from there.
You can also use FTP or you can download it directory by accessing by url.
Make sure you delete it after your download finishes.

How To - Automatic Backup and Restore MySQL db from Web Server to Local Machine

I have a web app that is supposed to be run on a single local machine (kiosk display), but I want the option to let a user make changes on the web (from any PC) and update the instance on their local PC (kiosk display). From what i imagine, the MySQL instance on the web server will just replace the MySQL instance on the local (kiosk display) machine. This can be done once nightly (doesnt have to be instantaneous).
Does anyone know of a way to do this? I am open to a product or coding it myself...
I will appreciate any info or brainstorm.
Thanks.
If the clients have fixed IPs, you can do this:
Create mySQL user accounts on server, allow them to log in from a specific IP range only, give them SELECT privileges
Install mysql client binaries on client PC
Use cron or the Windows Task Scheduler to do a remote mysqldump:
mysqldump -u username -h remote.server.com databasename > dump.txt
mysql -u local_username -h localhost databasename < dump.txt
this is not a perfect solution - the usual consensus is to have mySQL not accessible from the outside at all. But if you have fixed IPs, and can also maybe adjust the firewall to adjust mySQL connections from those IPs only, it's surely the easiest solution.
A safer solution might be:
Use a server side scripting language to build database dump locally and store it in a known directory
Install wget binaries on client side
Have the client side wget call the server side script (e.g. as a web page) that creates the dump
When the page has finished downloading (= the dump is done) start another wget, FTPing into the server (with very limited rights of course) and fetching the data dump just built - or, for security, use a safe protocol like sftp or scp/ssh. Putty has Windows binaries to that end.