So I just started learning MySQL. I am learning from Tizag. They are using PHP files. Now I can see that the PHP files are slightly complex, I'm only 15. And they also recommended PHPMyAdmin. This GUI tool has many complicated options. So I quite don't know what to use. The tutorial till now is using PHP files like

<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

// Create a MySQL table in the selected database
mysql_query("CREATE TABLE example(
id INT NOT NULL AUTO_INCREMENT, 
PRIMARY KEY(id),
 name VARCHAR(30), 
 age INT)")
 or die(mysql_error());  

echo "Table Created!";

?>

So what should I use? I think these PHP files. But then again they are complex and now I am just using XAMPP. When I go for hosting on 000webhost.com(my beloved hosting service), will it be even possible to use these files? Because they have PHPMyAdmin there (I think).

Warm regards,
Cadence

If you want to learn MySQL, forget PHP. Look for a MySQL or plain SQL tutorial which does not use PHP and learn the SQL basics using the command line tool mysql.

Any suggestions for such a tutorial?

And it is better if it also explains how to setup everything. And will I be able to use the command line tools on a real web server? If yes, how? As I said, now I am just learning on XAMPP.

will I be able to use the command line tools on a real web server

That will depend on your webhost. Some allow it, others don't. Check with them.

They are using PHPMyAdmin. What should I do now?

PhpMyAdmin is just a tool (written in PHP) to allow easy management access to your database.

Install MySQL on your PC. No need for an external server. And stop nagging me with private messages.

Here, smantscheff says

Look for a MySQL or plain SQL tutorial which does not use PHP and learn the SQL basics using the command line tool mysql.

  1. Is it really good to use command line?
  2. Should I continue with PHPMyAdmin or PHP files? If yes, which one?
  3. If I am supposed to use command line, how do I use it with my webhost? (000webhost.com)

Please answer in a list format.

Sorry smantscheff. But now I am using XAMPP. Later, when I head for the real websites on my web host(000webhost.com), what will I do?

If you're using xampp, mysql is also installed on your PC and you might as well use the command line. It is an invaluable tool for learning.
Later on, I'd recommend Navicat or, even better, HeidiSQL. These are fine database interfaces, while phpMyAdmin - due to its http-only limitations - is clumsy and awkward.

This website (phpforkids.com) gives this piece of code -

mysql -h host -u username -p

So if I am supposed to use this from the command prompt, which directory should I navigate to?

Wait I got the directory, but what is the default password?

I finally got it!!! Thanks a lot everyone!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.