1. install the following system-related library files: # yum-y install gcc-c ++ autoconf automake zlib * libxml * ncurses-devel libmcrypt * libtool * 2. Create the mysql installation directory and data storage directory # mkdir/usr/local/mysql # mkdir/var/mysqldata3, create users and user groups # groupadd mysql # useradd-g mysql mysql4, grant permissions to the data storage directory # chown mysql. mysql-R/var/mysqldata/5. After cmakemysql5.5is installed, download cmake-2.8.4.tar.gz through cmake. http://www.cmake.org Download the website # wget http://www.cmake.org /Files/v2.8/cmake-2.8.4.tar.gz # tar zxvf cmake-2.8.4.tar.gz # cd cmake-2.8.4 #./bootstrap # gmake & gmake install 2. install MySQL 5.5.211, plugin, or http://www.mysql.com/downloads/mysql Download from the official website # wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.21.tar.gz# Tar zxvf mysql-5.5.21.tar.gz # cd mysql-5.5.212, compiled mysql-5.5.21 # cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \-DMYSQL_UNIX_ADDR =/var/mysqldata/mysql. sock \-DDEFAULT_CHARSET = utf8 \-DDEFAULT_COLLATION = utf8_general_ci \-DWITH_EXTRA_CHARSETS: STRING = utf8, gbk \-DWITH_MYISAM_STORAGE_ENGINE = 1 \-DWITH_INNOBASE_STORAGE_ENGINE = 1 \-DWITH_MEMORY_STORAGE_ENGINE = 1 \-DWITH_READLINE = 1 \-DENABLED_LOCAL_INFILE = 1 \-D MYSQL_DATADIR =/var/mysqldata \-DMYSQL_USER = mysql \-DMYSQL_TCP_PORT = 3306 # make install3, copy the configuration file # cp support-files/my-medium.cnf/etc/my. cnf4. Grant the execution permission to the scripts/mysql_install_db file before initializing the database. # chmod 755 scripts/mysql_install_db # scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql /\ -- datadir =/var/mysqldata/Note: basedir: mysql installation path datadir: database file storage Path 5. Set mysqld startup # cp support-files/mysql. ser Ver/etc/init. d/mysql # chmod 755/etc/init. d/mysql # chkconfig mysql on6. Add the MySQL bin directory to the PATH for mysql environment variable configuration, which facilitates future management and maintenance. Add myslq/bin to/etc/profile, at the same time, add two aliases for easy operation: # export PATH =/usr/local/mysql/bin: $ PATH # alias mysql_start = "mysqld_safe &" # alias mysql_stop = "mysqladmin-u root-p shutdown" 7. Start mysql service #/etc/init. d/mysql start run the ps-ef | grep mysql command to check whether mysql is started. 8. log on to mysql # MySQL-u root-p. 3. Set mysql standard to roo. T set the initial password for the Account #/usr/local/mysql/bin/mysqladmin-u root password 'new-password' or restrict logon only through the local machine #/usr/local/mysql/bin /mysqladmin-u root-h 'hostname' password 'new-password' 2. delete an empty password account for anonymous connection from the local machine and log on to mysqlmysql> use mysql; // select the default database mysqlmysql> update user set password = 'root123' where user = '2017. 0.0.1 '; mysql> delete from user where password = ""; // the root password cannot be empty. mysql> flush privileges; mysql> quit allows the root user to log on remotely to the root account, if Other accounts should be created for remote logon. the root account does not have to enable remote logon. However, for general use, there are not many security requirements, allowing the root user to log on remotely for convenient management. After all, it is much easier to use the graphical interface of the dedicated management software for operations. 3. Set MySQL remote connection 1) mysql database settings #/mysql-u root-p // enter the database mysql> use mysqlmysql> select user, password, host from user; mysql> update user set host = '2017. 168.% 'where user = '127. 0.0.1 '; mysql> grant all privileges on *. * to root @ '%' identified by "root123"; // you can connect to the database by granting the root @ ip address logon remote connection permission. Common Causes of remote connection failure. Set the password of the remote login user to rootmysql> flush privileges; mysql> quit author lebwade