How to install mysql server on fedora

This howto will guide you on how to install mysql 5 on your fedora, start the mysql server on reboot, make new mysql users, change root and user's password and add new database, remove anonymous logins and give permissions to different users.

1) First of all install mysql client and server. Open the terminal and enter the following command

[jasonleon]$ yum install mysql mysql-server

2) Then Install the mysql package and start the mysql deamon by using the command

[jasonleon]$ service mysqld start

3)Start the mysql deamon everytime you boot

[jasonleon]$ chkconfig --level 2345 mysqld on

4) Login as root database admin to MYSQL server

[jasonleon]$ mysql -u root

5) Change the database password by using

[jasonleon]$ mysqladmin -u root password NEWPASSWORD

If you want to change or update the new password you can use the following command

[jasonleon]$ mysqladmin -u root -p OLDPASSWORD password NEWPASSWORD

Similary, you can change the password of other users

[jasonleon]mysqladmin -u username -p OLDPASSWORD password NEWPASSWORD

You can also change the password using mysql commands

Login to mysql server by typing following command at shell prompt

[jasonleon]$ mysql -u root -p

mysql> use mysql;

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='username';

mysql> reload privileges

mysql> FLUSH priviledges

6) If you have anonymous access to the database consider removing it.

mysql> DELETE FROM user where User='';

mysql> FLUSH PRIVILEGES

7) Add new users with database admin priviledges for all the databases

mysql> GRANT ALL PRIVILEGES ON *.* TO 'user' @'localhost' INDENTIFIED BY 'somepass' WITH GRANT OPTION;

8) We can also add permissions to a user for a specific database.

mysql> GRANT SELECT, INSERT, UPDATE, CREATE, DROP, INDEX, ALTER ON some_database.* TO 'user'@'localhost';

9) Add a new MYSQL database

mysql> create database db_name;

10) If you want to manage your database through a graphical user interface you can use mysql-administrator. Install mysql-administrator tool when installed you can find it in Application => System Tools.

[jasonleon]$ yum install mysql-administrator

1 Comment

web design (not verified)
March 12th, 2010 05:18 pm
I use actually fedora core 12 and this information is very useful thanks

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use syntax $$latex$$ to insert LaTeX formulas.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.