(Source: http://dev.mysql.com/doc/refman/5.6/en/linux-installation-rpm.html)
To download MySQL community server, follow http://dev.mysql.com/downloads/mysql/ -> GA release -> linux-generic ->
MySQL-server-5.6.23-1.linux_glibc2.5.x86_64.rpm
To download MySQL community client, follow http://dev.mysql.com/downloads/mysql/ -> GA release -> linux-generic ->
MySQL-client-5.6.23-1.linux_glibc2.5.x86_64.rpm
yum localinstall Downloads/MySQL-server-5.6.23-1.linux_glibc2.5.x86_64.rpm
The above command internally executes all the below steps.
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
less /etc/groups#should display mysql group
which mysqld #should display /usr/sbin/mysqld
ls /etc/rc.d/init.d #should contain mysql file. This file is used to start MySQL as system service.
chkconfig --list#should display MySQL with at least one flag ON
ls /var/lib/mysql# this is used as the data directory. This should contain all the core databases initialized by /usr/bin/mysqld_safe script.
yum localinstall Downloads/MySQL-client-5.6.23-1.linux_glibc2.5.x86_64.rpm
which mysql # should display /usr/bin/mysql
service mysql start # starts mysqld
mysql -uroot -ppassword # mysqld_safe stores password in file $home/.mysql-secret. If file not found in home directory, try to find in / directory.
As of MySQL 5.6.8, new RPM install operations (not upgrades) invoke mysql_install_db with the --random-passwords option that provides for more secure MySQL installation. Invoking mysql_install_db with --random-passwords causes it to assign a random password to the MySQL root accounts, set the “password expired” flag for those accounts, and not create anonymous-user MySQL accounts. It will be necessary after installation to start the server, connect as root using the password written to the $HOME/.mysql_secret file, and assign a new root password. Until this is done, root cannot do anything else. This must be done for each root account you intend to use. To change the password, you can use the SET PASSWORD statement (for example, with the mysql client).
No comments:
Post a Comment