Operating system |
CentOS 6.4 x86_64 |
MySQL version |
5.5.33 |
Installing dependent software
# yum-y Install gcc gcc-c++ ncurses-devel bison-devel libaio-devel
2. Installing CMake
# yum-y Install Cmake28
3. Compiling the installation
# groupadd-r MySQL
# useradd-g mysql-r-d/mysqldata-s/sbin/nologin MySQL
# Chown-r Mysql:mysql/mysqldata
# Tar XF mysql-5.5.33.tar.gz
# CD mysql-5.5.33
# CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/mysqldata-dsysconfdir=/etc-dwith_innobase_storage_ Engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith_readline=1-dwith_ssl=system- dwith_zlib=system-dwith_libwrap=0-dmysql_unix_addr=/tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation= Utf8_general_ci
# make
# make Install
4. mysql server initialization
Create a MY.CNF configuration file
# Cd/usr/local/mysql
# CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
# echo "DataDir =/mysqldata" >>/etc/my.cnf
Create a service script
# CP Support-files/mysql.server/etc/init.d/mysqld
# chmod +x/etc/init.d/mysqld
# chkconfig--add mysqld
# Chkconfig Mysqld on
Initializing the MySQL system database
# scripts/mysql_install_db--user=mysql--datadir=/mysqldata
modifying environment variables
# echo "Export path= $PATH:/usr/local/mysql/bin" >/etc/profile.d/mysql.sh
# . /etc/profile.d/mysql.sh
5. Modify the default password
# service Mysqld Start
# Mysql-uroot-p//Enter, default is blank password
Mysql>
Method One:
mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' 12345 ');
Method Two:
mysql> UPDATE user SET password = password (' 12345 ') WHERE user = ' root ';
mysql> FLUSH privileges;
Method Three:
# mysqladmin-uroot-hlocalhost Password ' new12345 '-p
# mysqladmin-uroot-hlocalhost-p Flush-privileges
6. Delete anonymous Users
Mysql> select User,host,password from Mysql.user;
+------+-----------------------+-------------------------------------------+
| user | Host | password |
+------+-----------------------+-------------------------------------------+
| Root | localhost | *96073409cd134870af004f84332f73924c906e9a |
| Root | Localhost.localdomain | |
| Root | 127.0.0.1 | |
| Root | :: 1 | |
| | localhost | |
| | Localhost.localdomain | |
+------+-----------------------+-------------------------------------------+
6 rows in Set (0.00 sec)
Delete the last two lines
mysql> drop user ' @ ' localhost ';
mysql> drop user ' @ ' localhost.localdomain ';
This article is from the "Tiger Shengwei" blog, be sure to keep this source http://tobeone.blog.51cto.com/817917/1575789
Compiling and installing mysql-5.5.33