Yum-y install make gcc-c++ cmake bison-devel ncurses-devel gcc kernel-devel readline-devel pcre-devel openssl-devel ope Nssl zlib zlib-devel Pcre-devel
Groupadd MySQL && useradd-r-g MySQL MySQL
Mkdir-p/usr/local/mysql
Mkdir-p/data/mysqldb
CMake \
-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/usr/local/mysql/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_innobase_storage_engine=1 \
-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1\
-DMYSQL_DATADIR=/DATA/MYSQLDB \
-dmysql_tcp_port=3306 \
-denable_downloads=1
Make && make install
Cd/usr/local/mysql
Chown-r Mysql:mysql.
Chown-r Mysql:mysql/data/mysqldb
scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql--ldata=/var/lib/ Mysql
CP support-files/mysql.server/etc/init.d/mysqld && chmod +x/etc/init.d/mysqld
Cat >>/etc/profile << "EOF"
Path=/usr/local/mysql/bin:/usr/local/mysql/lib: $PATH
Export PATH
Eof
Source/etc/profile
Service mysqld Start
Chkconfig--level mysqld on
Ln-s/var/lib/mysql/mysql.sock/usr/local/mysql/mysql.sock
Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Cat >>/etc/rc.local << "EOF"
Ln-s/var/lib/mysql/mysql.sock/usr/local/mysql/mysql.sock
Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Eof
1. For example, your root user does not now have a password and you want the password to be changed to 123456, then the command is:
Mysqladmin-u Root Password 123456
2. If your root now has a password (123456), then the command to change the password to ABCdef is:
Mysqladmin-u root-p Password abcdef
Note that the command will ask you the old password, enter the old password 123456 after the command completes, the password modification succeeds.
-dcmake_install_prefix=dir_name setting up the MySQL installation directory
-dmysql_unix_addr=file_name set the listener socket path, which must be an absolute pathname. Default is/tmp/mysql.sock
-ddefault_charset=charset_name sets the character set of the server.
By default, MySQL uses the latin1 (CP1252 Western European) character set. The Cmake/character_sets.cmake file contains a list of allowed character set names.
-ddefault_collation=collation_name sets the collation of the server.
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_perfschema_storage_engine=1 Storage Engine Options:
Myisam,merge,memory, and the CSV engine is compiled to the server by default and does not need to be explicitly installed.
Statically compiles a storage engine to the server, using-dwith_engine_storage_engine= 1
The available storage engine values are: ARCHIVE, Blackhole, EXAMPLE, Federated, Innobase (InnoDB), PARTITION (partitioning support), and Perfschema ( Performance Schema)
-dmysql_datadir=dir_name setting up the MySQL database file directory
-dmysql_tcp_port=port_num set MySQL server listening port, default is 3306
-denable_downloads=bool if you want to download the optional file. For example, if you enable this option (set to 1), CMake will download the test suite that Google uses to run unit tests.
mysql-5.6.25 Configuration and Installation