Actualizar paquetes necesarios para la compilación
yum install cmake gcc gcc-c++ ncurses-devel bison
Descargar Fuente de Mysql
useradd mysql5721
su - mysql5721
wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.21.tar.gz
tar xf mysql-boost-5.7.21.tar.gz
cd mysql-5.7.21
rm -rf CMakeCache.txt; \
make clean; \
cmake . \
-DWITH_BOOST=boost/boost_1_59_0/ \
-DCMAKE_INSTALL_PREFIX=${HOME}/MySQL/ \
-DCMAKE_BUILD_TYPE=Release \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STPRAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWIYH_READLINE=1 \
&& make && make install
[mysql5721@CentOS ~]$ cd ${HOME}/MySQL
[mysql5721@CentOS MySQL]$ mkdir -p ~/MySQL/etc
[mysql5721@CentOS MySQL]$ vim etc/my.cnf
[mysql5721@CentOS MySQL]$ cat etc/my.cnf
[client]
port=3311
socket=/tmp/mysql.sock_001
[mysqld]
# mysqld Basic settings
log-error = /home/mysql5721/MySQL/mysql-error.log
pid-file = /home/mysql5721/MySQL/mysql.pid
basedir = /home/mysql5721/MySQL
datadir = /home/mysql5721/MySQL/data
port=3311 # Default is 3306
log-error = mysql-error.log
socket = /tmp/mysql.sock_001
pid-file = mysql.pid
default-time-zone = '+8:00'
# mysqld Binary log correlation
log-bin=mysql-bin
server_id=1000001
binlog_format = mixed
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 1G
# mysqld Performance related
max_connections = 3000
max_allowed_packet = 4M
sort_buffer_size = 16M
join_buffer_size = 8M
thread_cache_size = 64
query_cache_size = 64M
query_cache_limit = 4M
tmp_table_size = 256M
default_storage_engine = InnoDB
key_buffer_size = 384M
[mysql5721@CentOS ~]$ /home/mysql5721/MySQL/bin/mysqld --verbose --help
[mysql5721@CentOS ~]$ cd ${HOME}/MySQL
[mysql5721@CentOS MySQL]$ mkdir -p data;
[mysql5721@CentOS MySQL]$ rm -rf data/*; ./bin/mysqld --initialize
[mysql5721@CentOS MySQL]$ grep temporary mysql-error.log
[mysql5721@CentOS MySQL]$ ./bin/mysqld_safe & # start-up MySQL service , Run the warehouse file with the process
[mysql5721@CentOS MySQL]$ ./bin/mysqladmin -uroot -p shutdown # Close MySQL service
[mysql5721@CentOS MySQL]$ ./bin/mysql -hlocalhost -uroot -p # Land MySQL
Enter password: Enter the temporary password you just received in grep temporary mysql-error.log
mysql> ALTER USER USER() IDENTIFIED BY 'root';
Query OK, 0 rows affected (0,11 sec)
mysql> use mysql;
Database changed
mysql> select host, user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
3 rows in set (0,01 sec)
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0,04 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host, user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+---------------+
3 rows in set (0,00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0,03 sec)
mysql> quit
Bye
[root@CentOS MySQL]# vi /etc/init.d/mysql5721
[root@CentOS MySQL]# cat /etc/init.d/mysql5721
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops MySql 5.7.21
#
start() {
echo "Iniciando MySql 5.7.21: "
su - mysql5721 /home/mysql5721/MySQL/bin/mysqld_safe & 2>/dev/null
}
stop() {
echo "Finalizando MySql 5.7.21: "
FILE=$(/bin/grep ^pid-file /home/mysql5721/MySQL/etc/my.cnf |/usr/bin/tail -1|/bin/cut -d= -f2)
if [ -f "$FILE" ] ;
then
PID=$(/bin/cat "$FILE")
/bin/kill $PID 2>/dev/null
else
echo "No existe el archivo $FILE"
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
exit $?
[root@CentOS MySQL]# chkconfig --add mysql5721
[root@CentOS MySQL]# chkconfig mysql5721 on
[root@CentOS MySQL]# service mysql5721 start |