~ Sharing configurations, knowledge and experience in the world of computer systems

Easy installation of MySQL in Linux Mint 15

The recommended database client for database novices is MySQL. Being a light database, MySQL is easy to use and configure. Also, distributions such as Debian-based Linux Mint already have packages ready to be installed from the default repository. In this post, let me demonstrate how I installed MySQL:

Steps taken to install MySQL in Linux Mint:

1. Download MySQL client:
bash> apt-get install mysql-client

2. Download MySQL server:
bash> apt-get install mysql-serverNote: During installation of mysql-server, you will prompted to enter the root password. It is recommended to set it up.

3. Test if installation is successful using the following commands:
bash> /usr/bin/mysqladmin version
bash> /usr/bin/mysqladmin variablesNote: You should see an output showing details regarding mysql

4. Upon installation of mysql, a database named ‘test’ is already created by default. Test connection by connecting to the database
bash> mysql -u test
mysql>
You can now connect to the database

5. You can add user accounts using the following commands:
bash> mysql -u root -p —–> (log in as root first)
Password:
mysql> GRANT USAGE ON test.* TO user@localhost
-> IDENTIFIED BY ‘test’;
This creates an account named ‘user’ with the password ‘test’ on the database named test and all the tables (denoted by *).

Additional Options:
You can also grant priveleges to user accounts:
mysql> GRANT SELECT ON test.* TO user@localhost
-> IDENTIFIED BY ‘pwd’;
This gives the account ‘user’ read priveleges (SELECT Statement) to the database ‘test’ with password ‘pwd’.
If you want the user full control over the database, you can also do:
mysql> GRANT ALL ON test.* TO user@localhost
-> IDENTIFIED BY ‘pwd’;