| | |||||
| ||||||||
| Webmaster Tutorials Instructional webmaster-related how-to's and tutorials. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||
| Account Closed Join Date: Jun 2005 Location: Mozambique
Posts: 607
![]() ![]() | HOW TO: Use shell to control MySQL. Some people have a shell account with hosting but dont have a clue on how to put it to some good use. Shell Account or SSH can save alot of time if used properly. I will show how to do some of the most common tasks easily and faster in shell. First of all you will need a ssh client to connect to the remote server. I use PuTTY to access my shell accounts but you can use anyone that you like, there are plenty available. Use your domain-name as your hostname and login. Enter username and password when required. Once you are logged in you will see: "username@localhost$" or something similar. at this point type:
????: NamePros.com http://www.namepros.com/webmaster-tutorials/109303-how-to-use-shell-control-mysql.html You can move around different folders using CD command just like Ms-Dos prompt. Remember instead of "cd.." for moving to the previous folder, you will have to type "cd .." space between cd and .. Starting MySQL: type:
If your database server is located somewhere else then type:
After typing the command, hit enter. It will now ask for the the password associated with that username. Enter password and hit enter. Now you will see "mysql>" instead of "username@localhost:>". This means we have successfully logged in to Mysql. Selecting Database to use: At mysql> type:
Adding a new Database: At mysql> type:
Deleting a Database: At mysql> type:
Creating Tables: At mysql> type:
Deleting Tables: At mysql> type:
Exiting MySQL: Simply type:
????: NamePros.com http://www.namepros.com/showthread.php?t=109303 Now you are back to shell prompt. Backing up your database: At normal shell (Not mysql>) type:
Hit enter, it will ask you for your database password. Enter the password and hit enter. All done. This will output a file "blog.bak.sql.bz2" in the folder you were working in (public_html). NOTE: I am using blog as an example for the output file. You can name it as you feel like, just dont change .sql.bz2 extention. i.e. forum.bak.sql.bz2 or forum.sql.bz2... Restoring the database: The database that we created in previous step is compressed in order to give us a small file. To restore the database we first need to uncompress the database. Supposing that you are in the same folder as the compressed file.Type:
Now type:
Hit Enter, it will ask for your database password, type it and hit enter. VOILA! Your database is restored. Using shell may look tedious and hard at first but once you get hold of it, you will feel "more at home" with it than any other control panel. Hope this help those people with shell account but did not know how to use it. MODS: If you like the topic and think it is useful then please sticky it. Thank You
Last edited by abdulmueid; 07-31-2005 at 04:11 AM.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| |
| | THREAD STARTER #5 (permalink) |
| Account Closed Join Date: Jun 2005 Location: Mozambique
Posts: 607
![]() ![]() | I will be posting more on Shells since I used to be a "junior" admin myself some time ago, so i know quite alot about it and have working experience. P.S. My current host likes being old skool and has no cPanel. All site management has to be done via Shell |
| |
| | #7 (permalink) | ||||
| Senior Member Join Date: Mar 2005 Location: Quebec, Canada
Posts: 2,023
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | THREAD STARTER #8 (permalink) |
| Account Closed Join Date: Jun 2005 Location: Mozambique
Posts: 607
![]() ![]() | It was pain in the beginning, I mean I got the hosting in 2003 and still have it. Been using it all that time. It was/is my first hosting ever, when I got hosted there i had never even heard about cPanel. Only way to survive was to learn and I did it |
| |
| | #9 (permalink) |
| Senior Member Join Date: Mar 2005 Location: Quebec, Canada
Posts: 2,023
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | you should make a site with these tutorials as lots of people don't know how to use shell. There aren't tons of tutorials for that either. If you know of any place with all the basic commands shown that would be cool as i don't know much of them. Only a few. |
| |
| | #12 (permalink) |
| NamePros Regular Join Date: Jul 2005
Posts: 247
![]() | Nice tutorial and thanks for sharing!
__________________ AIMForum.com - Ready, AIM, Chat! Forum Elves - Quality Forum Posting At Affordable Prices! - Order A Package |
| |
| | #13 (permalink) | ||||
| NamePros Regular Join Date: Jul 2005
Posts: 851
![]() | Great, thanks for sharing! ![]()
| ||||
| |
| | THREAD STARTER #14 (permalink) |
| Account Closed Join Date: Jun 2005 Location: Mozambique
Posts: 607
![]() ![]() | I have created a section dedicated to shells on my website at www.crazylittleworld.com Click here to access the archive for shell. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows | deadserious | Webmaster Tutorials | 96 | 05-27-2007 02:24 PM |
| Tutorial: How to Install Apache2 MySQL and PHP on Windows | deadserious | Webmaster Tutorials | 35 | 09-21-2005 10:46 PM |
| database transfer | domainabilities | Programming | 2 | 02-15-2005 09:00 PM |
| Tutorial: Getting Started With MySQL (The Basics) | deadserious | Webmaster Tutorials | 3 | 04-18-2004 02:17 PM |