Install MySQL Database server in Ubuntu
February 15, 2012 in MySQL
Install MySQL Database server in Ubuntu / Debian
What is MySQL?
MySQL is most popular open source database. It is a high performance and reliable database and it is easy to use. MySQL runs on almost all known Operating Systems including Ubuntu.
How to install MySQL on Ubuntu 11.04
You can install MySQL Server from the terminal. Just type:
$> sudo apt-get install mysql-server
To install MySQL client just use the Following command
$>sudo apt-get install mysql-client
Or you can install both of them at once by typing:
$>sudo apt-get install mysql-server mysql-clinet
while the installation is in progress a screen like the following will appear and ask you for a password for MySQL root user. Please be sure to type something that you will not forget because you will need that to grand access to MySQL.
After pressing ok MySQL installation will ask you to retype the password for MySQL root user.
If you are going to use php on you server you also have to install PHP for MySQL by typing the following:
$>sudo apt-get install php-mysql
Congratulations now you have MySQL server up and running on your system.
If you want to access MySQL console just type
$>mysql -u root -p
Enter your MySQL root password and you are in the MySQL console
Here is a video tutorial on how to install MySQL on Ubuntu 11.04
MANY MANY THANKS……………..
can u further tell how to connect mysql to php
Dear Akash,
In order to connect to MySQL server from PhP you need to open a connection first. So you need to use the mysqli_connect() function.
Let’s store this connection to php_mysql variable
$php_mysql=mysqli_connect(“localhost”,”root”,”password”,”dm_name”);
Where “localhost” is the IP or the hostname of your MySQL Server if you have followed the guide this should be localhost.
Where “root” the username for your database in my example that is root
Where “password” the password you choose when you setup the database
And ”db_name” the database name.
Regards
Allaboutlinux.eu
thank you very much . from algeria ^^