MySQL Database binaries installation-(mysql-172.16.1.6)
1. Create Users and directories
Useradd mysql-s/sbin/nologin-m
Mkdir/application
2. Download Unzip
Tar XF mysql-5.5.32-linux2.6-x86_64.tar.gz
MV Mysql-5.5.32-linux2.6-x86_64 mysql-5.5.32
Ln-s/application/mysql-5.5.32/application/mysql
Chown-r Mysql.mysql/application/mysql
3. Initializing the database
/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data/-- User=mysql
4. Build the configuration file
Cp/application/mysql/support-files/my-small.cnf/etc/my.cnf
Cat/application/mysql/bin/mysqld_safe
5. Modify the binary package boot path and start MySQL in the background
Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe
/application/mysql/bin/mysqld_safe &
6. Modifying environment variables
Echo $PATH
cp/application/mysql/bin/*/usr/local/sbin/
7. Login Test
Mysql
Exit
8. Configure the optimized startup mode
Cp/application/mysql/support-files/mysql.server/etc/init.d/mysqld
Sed-i ' S#/usr/local/mysql#/application/mysql#g '/etc/init.d/mysqld
chmod +x/etc/init.d/mysqld
Killall MySQL
Lsof-i: 3306
Killall mysqld
Lsof-i: 3306
Netstat-lntup | grep MySQL
/etc/init.d/mysqld start
Chkconfig mysqld on
Chkconfig--list mysqld
9. Setting and changing passwords
Mysqladmin-uroot password "Oldboy"
Mysqladmin-uroot-poldboy password "123456"
10. Login command with password
mysql-uroot-p123456
Mysql-uroot-p
11.mysql Simple Operation command
show databases;
Use MySQL;
Show Tablesl
Select User,host from Mysql.user;
Select User ();
Select Database ();
Drop database databasename;
Drop user ' username ' @ ' hostname ';
This article is from the "Stressed Eggs" blog, please be sure to keep this source http://78124107.blog.51cto.com/5557978/1972006
Egg Student Movement -7:mysql Service installation configuration