0: confirm the system information: [root @ brief dtmysql] catetcissueCentOSrelease64 (Final) Kernelronanm 1: install [op1 @ VMS06968 ~] in yum mode $ Yumlistmysql * Loadedplugins: dow
0: determine the system information:
[Root @ mongodt mysql] # cat/etc/issue
CentOS release 6.4 (Final) Kernel \ r on an \ m
I. yum installation
[Op1 @ VMS06968 ~] $ Yum list mysql *
Loaded plugins: downloadonly, fastestmirror, security
Determining fastest mirrors
Installed Packages
MySQL-client.x86_64 5.6.21-1. el6 @ custom.
Mysql-libs.x86_64 5.1.66-2. el6_3 @ anaconda-CentOS-201303020151.x86_64/6.4
Available Packages
MySQL-devel.x86_64 5.6.21-1. el6 custom.
MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 base
MySQL-server.x86_64 5.6.21-1. el6 custom.
# Install the server [op1 @ VMS06968 ~] $ Yum install mysql-server
# Install the client [op1 @ VMS06968 ~] $ Yum install mysql
If an error is reported during installation, run the following command to delete the mysql-related lib:; and then perform the two steps for installation. [op1 @ VMS06968 ~] $ Yum remove mysql *
II. know the installation directory of mysql:2.1 Database Directory/var/lib/mysql/
2.2 configuration file/usr/share/mysql (mysql. server command and configuration file)
2.3 Related commands/usr/bin (mysqladmin mysqldump and other commands)
2.4.1. start script 1/etc/rc. d/init. d/mysql (mysql Directory of the startup script file) 2.4.2, start script 2/etc/init. d/mysql (directory for starting the script file mysql)
2.5mysql configuration file/usr/my. cnf (find it)
3. edit the/usr/my. cnf file as follows:
[Root @ mongodt mysql] # vi/usr/my. cnf # export = 0.0.0.0port = 3306
[Mysqld] datadir =/var/lib/mysqlsocket =/var/lib/mysql. sockcharacter-set-server = utf8sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLESdefault-storage-engine = INNODB # default data storage format max_connections = 10innodb_buffer_pool_size = 256 M # memory query_cache_size = 30 M
[Mysql] default-character-set = utf8
4. restart the mysql service and modify the default password:1) mysqladmin-u root password 'newpassword:
[Root @ mongodt mysql] # mysqladmin-u root password 'root' ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)
1. stop mysql service: #/etc/rc. d/init. d/mysqld stop2. enter the command: # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & 3. log on to the database: # mysql-u root mysql4, mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD ('root') where USER = 'root'; mysql> flush privileges; mysql> quit5. restart the service: #/etc/init. d/mysql restart if a new user name is used, the following error is returned when logging in with the password:
Mysql> show databases; ERROR 1820 (HY000): You must set password before executing this statement
6. run mysqladmin-u root-proot password 'root'. now the root user can use the data normally. # mysql-u root-proot # The data can be used normally!
V. start the mysql service and set it as a system service:
# Chkconfig mysqld on startup
# Chkconfig-list mysqld restart confirm MySQL self-starting mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off slave if 2-5 is on status OK
# Service mysqld start restart start the service (#/etc/rc. d/init. d/mysqld start)
6. delete anonymous users and test databases:
Delete from mysql. user where user = "; then delete anonymous users select user, host from mysql. user; then view user information
Select version (), current_date; # Current version information, date and database: show databases; tables: View existing databases in the system drop database test; tables: delete empty databases named test