MySql Installation Procedure On Linux Command Line Yum Step By Step

How To Install Mysql On Linux through Command Line

There are multiple ways to install mysql on Linux machine

Installing through Yum:

If your server is on internet and yum repository is enabled, then you can install directly by runing the below command on linux console.

#yum install -y mysql-server


Installing:
mysql-server x86_64 5.1.47-2.fc12
Installing for dependencies:
perl-DBD-MySQL x86_64 4.016-1.fc12
perl-DBI x86_64 1.609-3.fc12
Updating for dependencies
mysql x86_64 5.1.47-2.fc12
mysql-libs x86_64 5.1.47-2.fc12

Installing from RPM:

Download the latest mysql-server rpm from rpm.pbone.net
You may need to download and install the dependency packages (mysql-libs, mysql, perl-DBD-MySQL, perl-DBD )before installing mysql-server
Transfer the downloaded file to the server using winscp or some other file transfer method

#rpm -ivh mysql-libs* mysql* perl-DBD-MySQL* perl-DBD*
#rpm -ivh mysql-server*

Initial Configurations:

After installing the mysql using one of the above method, you can start mysql with the default my.cnf settings

#service mysqld start
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
/usr/bin/mysqladmin -u root password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation


Default my.cnf file

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

# To allow mysqld to connect to a MySQL Cluster management daemon, uncomment
# these lines and adjust the connectstring as needed.
#ndbcluster
#ndb-connectstring="nodeid=4;host=localhost:1186"

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[ndbd]
# If you are running a MySQL Cluster storage daemon (ndbd) on this machine,
# adjust its connection to the management daemon here.
# Note: ndbd init script requires this to include nodeid!
connect-string="nodeid=2;host=localhost:1186"

[ndb_mgm]
# connection string for MySQL Cluster management tool
connect-string="host=localhost:1186"

How to reSet mysql root password:

By default there will be no password set for mysql admin (root). Now you can set root password using the below command 
#/usr/bin/mysqladmin -u root password 'new-password'
#mysqladmin -u root password mysqlpasswd
Now you can login to mysql server using the below commands
#mysql -u root -p
Related Articles:
How to create database
How to reset root password




FOLLOW US :-    
   


0 comments :

Post a Comment