Tweaking MySQL on Fedora

Posted by {"name"=>"Palash Ray", "email"=>"paawak@gmail.com", "url"=>"https://www.linkedin.com/in/palash-ray/"} on August 20, 2010 · 1 min read

MySQL is installed on Fedora and most Linuxes by default. Its just about some tweaking before you can use it. I am detailing some of the rather useful commands.

To Install MySQL and start it

mysql_install_db
mysqld_safe &

Make MySQL case insensitive

This is useful when the DB Script is also expected to run on Windows server.
vi /etc/my.cnf

[mysqld]
lower_case_table_names=1

To change the root password

mysql>
update user set password=password("newPassword")  where user='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0
grant all on *.* to 'root'@'192.168.%' identified by 'newPassword';
FLUSH PRIVILEGES;

Adding a user

mysql>
insert into user (host, user, password) values('localhost','newUser',password('xx123'));
insert into  host(host,db,Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv)  values('localhost','dbName','Y','Y','Y','Y','Y','Y');
grant all on dbName.* to 'newUser'@'localhost' identified by 'xx123';
FLUSH PRIVILEGES;