MySQL database 1) Create a mysql user's account
# Useradd Mysql-s/sbin/nologin–m
Set up a fixed directory to store all installed software
#mkdir-P/home/data/tools
2
)
get MySQL package
Http://mirrors.sohu.com
3) binary mode installation MySQL
#tar XF mysql-5.5.49-linux2.6-x86_64.tar.gz
#mkdir-P/application/
#mv mysql-5.5.49-linux2.6-x86_64/application/mysql-5.5.49
#ln-S/application/mysql-5.5.49/application/mysql
4) Initialize MySQL configuration ask that my.cnf
#cd/application/mysql
#\cp support-files/my-small.cnf/etc/my.cnf
5) Initialize MySQL database file
# mkdir-p/application/mysql/data/
#chown-rmysql.mysql/application/mysql/
#/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/application/mysql/data-- User=mysql
Configure and start MySQL Database
1) set MySQL startup script
# CP Support-files/mysql.server/etc/init.d/mysqld
# chmod +x/etc/init.d/mysqld
2 ) MySQL the binary default installation order is /usr/local/mysql , the startup script is /usr/local/mysql paths need to be replaced.
# sed-i ' s#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld
3 ) Start MySQL Database
#/etc/init.d/mysqld Start
or use
#/application/mysql/bin/mysqld_safe--user=mysql &<==
4 ) Check MySQL whether the database is started
# netstat-lntup|grep MySQL
5 ) View MySQL database Startup results Log
# Tail-10/application/mysql/data/web01.err
6 ) Settings MySQL Boot from boot
# chkconfig--add mysqld
# Chkconfig Mysqld on
# chkconfig--list mysqld
7 ) configuration MySQL Global Use path of the command
#echo ' export path=/application/mysql/sbin: $PATH ' >>/etc/profile
#source/etc/profile
#echo $PATH/application/mysql/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
8 ) Login MySQL Test
#mysql <== directly knocked into the database, and identity or root
>show databases; <== View all current databases
>select user (); <== viewing the current logged-on user
>quit
MySQL Security Configuration
1 ) to MySQL of the Root User Set Password
# mysqladmin-uroot password ' 123456 '
2 ) to clean up useless MySQL Users and Libraries
>select user,home from Mysql,user;
>drop user "root" @ ":: 1";
>drop user "@" localhost ";
>drop user "root" @ "www";
>drop user "@" www ";
>select user,home from Mysql,user;
>flush privileges;
This article is from "Little New" blog, please be sure to keep this source http://zhanghongxin.blog.51cto.com/11255031/1847048
MySQL binary installation