Create a MySQL user
Useradd mysql-m-s/bin/nologin && ID mysql
Unpack binary Packages
Tar XF mysql-5.5.xx-linux2.6-x86_64.tar.gz
Copy to the/application directory and rename
Mkdir-p/application
MV mysql-5.5.xx .../aplication/mysql-xxx
Create a soft connection remove the version number
Ln-s/application/mysql-5.5.xx/application/mysql
Initialize Database (mysql5.5), authorize MySQL user to manage database files
/application/mysql/scripts/mysql_install_db \
--basedir=/application/mysql/--datadir=/application/mysql/data/--user=mysql &&\
CHOWN-VR Mysql.mysql/application/mysql
Initialize the error when the corresponding directory can be deleted, check the permissions and re-execution, note that the/tmp directory permissions should be 1777
/bin/rm-fr/application/mysql/data/*
Copy one of the files in the standard profile directory to/ETC/MY.CNF, configure the startup script
Cd/application/mysql/support-files &&\
/BIN/CP/APPLICATION/MYSQL/SUPPORT-FILES/MY-SMALL.CNF/ETC/MY.CNF &&\
Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe
Start MySQL, run in the background
/application/mysql/bin/mysqld_safe &
Lsof-i: 3306
Configure the command path to $path
Cat >>/etc/profile <<eof
Mysql_home= "/application/mysql"
Path= "\${mysql_home}/bin:\${path}"
Eof
. /etc/profile
Copy and modify the startup script into the/etc/init.d/to start the boot management (chkconfig management 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 &&\
Chkconfig mysqld on &&\
Chkconfig--list mysqld
After exiting MySQL, set up the root password of MySQL, re-login will require a password
Mysqladmin-uroot password "11111111" &&\
Mysql-uroot-p
MySQL Change password
mysqladmin-uroot-p11111111 password "NewPassword"
MySQL Basic statement
show databases; View Gallery
Select User (); View Current User
Use MySQL; Use a library
Select Database (); View Current Library
drop database test; Delete Library
Show tables; View Table
Select User,host from Mysql.user; View system users, two fields determine a user
Drop user ' @ ' localhost '; flush privileges; Delete user, some user name is empty, with ' '
Delete from Mysql.user where user= ' root ' and host = ' localhost '; flush privileges; Delete a user in the table
Grant all on * * to ' 123 ' @ ' localhost ' identified by ' 11111111 ' with grant Option;flush privileges; Create user
Help
Quit quitting
MySQL error log
/application/mysql/data/mysql_server.err
This article is from the "Magic Conch" blog, please be sure to keep this source http://bilishell.blog.51cto.com/11756401/1829340
Note: CENTOS6 mysql configuration test