Environment: CentOS 6.5
[[email protected] software]# yum -y install gcc gcc-c++[[email protected] software]# tar -zxvf cmake-2.8.5.tar.gz[[email protected] software]# cd cmake-2.8.5[[email protected] cmake-2.8.5]# ./configure --prefix=/usr/local/ CMake Cmake has bootstrapped. now run gmake. [[Email protected] cmake-2.8.5]# gmake[[email protected] cmake-2.8.5]# make install[[email protected] software]# yum -y install bison Ncurses-devel[[email protected] software]# useradd mysql -s /sbin/nologin[[email protected] software]# tar -zxvf mysql-5.5.25.tar.gz[[email protected] software]# cd mysql-5.5.25[[email protected] mysql-5.5.25]# mkdir -p /usr/ local/mysql/data[[email protected] mysql-5.5.25]# mkdir -p /usr/local/mysql/etc[[email protected] mysql-5.5.25]# mkdir -p /usr/ Local/mysql/log[[email protected] mysql-5.5.25]# /usr/local/cmake/bin/cmake -dcmake_ Install_prefix=/usr/local/mysql -dmysql_unix_addr=/usr/local/mysql/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_readline=1 -denabled_local_infile=1 -DMYSQL_DATADIR=/usr/local/mysql/data[[email protected] mysql-5.5.25]# make & &make install[[email protected] mysql-5.5.25]# make clean &&rm -rf cmakecache.txt /etc/my.cnf[[email protected] mysql-5.5.25]# chown mysql: mysql /usr/local/mysql/ -r[[email protected] mysql-5.5.25]# cd /usr/local/mysql/ [[email protected] mysql]# cp support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf[[email protected] mysql-5.5.25]# cp support-files/mysql.server /etc/init.d/mysqld[[email protected] Mysql-5.5.25]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/usr/local/mysql/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql //initializing MySQL database [[email protected] ~]# chmod +x /etc/ Init.d/mysqld[[email protected] ~]# head -n 47 /etc/init.d/mysqld |tail -n 2basedir= "/usr/local/mysql" datadir= "/usr/local/mysql/data" [[email protected] ~]# /etc/init.d/mysqld startstarting mysql... success! [[email protected] ~]#
[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# netstat-tunlp|grep mysqldtcp 0 0 0.0.0.0:330 6 0.0.0.0:* LISTEN 1451/mysqld[[email protected] ~]#[[email protected] ~]#/usr/loca L/mysql/bin/mysqladmin-u root password Redhat//Just loaded the database use this command to set the password for the root user
[Email protected] ~]#/usr/local/mysql/bin/mysql-u root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3
Server Version:5.5.25-log Source Distribution
Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
To modify the root user password:
To modify the root user password externally:
[[email protected] ~]#/usr/local/mysql/bin/mysqladmin-u root-p password "redhat" Enter password: [Enter the original password][[email prote CTED] ~]#
In the MySQL database, change the root user password:
[Email protected] ~]# /usr/local/mysql/bin/mysql-u root-p
Enter password:[the original password]
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 9
Server Version:5.5.25-log Source Distribution
Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> use mysql;database changedmysql> Update user set Password=password (' redhat123 ') where user= ' root '; Query OK, 4 rows affected (0.01 sec) rows Matched:4 changed:4 warnings:0mysql> quitbye[[email protected] ~]# ln-s /usr/local/mysql/bin/*/bin/
This article from "Pengcheng-soy sauce bottle" blog, declined reprint!
Source compiled MySQL