mysql installation
Installation:
· Following are some of the prerequisite dependencies before installing mysql
§ php-mysql, unixODBC, myODBC-x.x.rpm, bison, bison-devel, ncurses, ncurse-devel, zlib, zlib-devel, openssl, gnutls-devel, gcc, gcc-c++.
How to check any mysql packages installed or not in your Redhat/Fedora system
§ rpm –qa|grep mysql
· Yum installation process
§ yum install mysql
§ yum install mysql-server
§ yum install mysqlclient10
§ yum install mysql-devel
· RPM installation process
§ rpm –ivh mysql-x.x.x.rpm
§ rpm –ivh mysql-server.x.x.x.rpm
§ rpm –ivh mysqlclient10
§ rpm –ivh mysql-devel
After installation check once again whether the mysql server is installed or not by using
rpm –qa|grep mysql command
Start the service/database MySQL by any of the following two commands
· Process to Start the MySQL server.
§ /etc/rc.d/init.d/mysqld start
or
§ service mysqld start
If you want your mysql server should be running at system start up then type the following command.
§ chkconfig mysqld on
Post installation:
· The default userid for the Admin user in mysql database is `root` and the password is blank I mean nothing.
So for security reason you need to put the password for the mysql database.
The first task is to assign a password:
mysqladmin -u root password 'new-password'
Note: the following SQL commands will also work:
Login to your mysql database by typing the following in the command prompt
mysql –uroot
Once you get login in the mysql prompt type the following commands.
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE
user='root';
mysql> FLUSH PRIVILEGES;
Note: The user table is the important table in mysql database this is the table where the USER information exist. Like which IP can access the mysql database, which user can access which database, what are the privileges etc.
If you want to give all rights and privileges to root or any other user you can use the following sql from mysql prompt in the mysql database.
insert into user(Host,User,Password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Reload_priv,Shutdown_priv,
Process_priv,File_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Show_db_priv,Super_priv,Create_tmp_table_priv,
Lock_tables_priv,Execute_priv,Repl_slave_priv,Repl_client_priv,Create_view_priv,Show_view_priv,Create_routine_priv,
Alter_routine_priv,Create_user_priv,max_questions,max_updates,max_connections,max_user_connections) values('localhost','root',password(‘admin’),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',0,0,0,0);
Note: U might need to change a few entries in the query depending on the versions of mysql you are using. If you specify ‘%’ as a value of host in the above insert statement then anybody can access your database from any system as root user.
Once you change the password you need to restart the database to make the changes effective by the following command.
service mysqld restart
Once the mysql server restart you can login to the database by the following command in the command in the command prompt.
mysql –uroot –padmin –hlocalhost
mysql –uroot –padmin –hlocalhost