Install mysql5.7 by compiling so

2019-03-14  本文已影响0人  ArthurIsUsed
[root@backend-cxy mysql]# rpm -qa | grep mysql
mysql-libs-5.1.73-8.el6_8.x86_64
[root@backend-cxy mysql]# rpm -e mysql-libs-5.1.73-8.el6_8.x86_64 --nodeps
 wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz 
tar xf mysql-boost-5.7.18.tar.gz
cd mysql-5.7.18
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=boost/boost_1_59_0
make && make install
cd /usr/local/mysql
mkdir data
chown -R mysql. /usr/local/mysql
[root@backend-cxy ]#cd ./bin
[root@backend-cxy bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2017-09-05T15:03:41.067600Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-05T15:03:41.338120Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-09-05T15:03:41.369521Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-09-05T15:03:41.426215Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6778cd1c-924b-11e7-a8c2-0050569e3837.
2017-09-05T15:03:41.426860Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-09-05T15:03:41.429970Z 1 [Note] A temporary password is generated for root@localhost: rU?Dow;aA8oF
/usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# vim /etc/my.cnf
[mysqld]
basedir =/usr/local/mysql
datadir =/usr/local/mysql/data
port = 3306
socket = /tmp/mysql.sock
[client]
socket=/tmp/mysql.sock
/etc/init.d/mysqld start
/usr/local/mysql/bin/mysql -uroot -p系统生成的密码
mysql>set password = password(‘Newpassword‘);
mysql>flush privileges;
mysql>exit
/usr/local/mysql/bin/mysql -uroot -p‘Newpassword'
rpm -qi mysql-server
service mysqld start
[root@xiaoluo ~]# chkconfig --list | grep mysqld
mysqld             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭
[root@xiaoluo ~]# chkconfig mysqld on  <---开机启动
[root@xiaoluo ~]# chkconfig --list | grep mysql
mysqld             0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
mysql> set password = password("steve201718");
mysql> flush privileges;
mysql> exit 
/usr/local/mysql/bin/mysql -uroot -p NewPassword
[root@backend-cxy]# ln -s /usr/local/mysql/bin/mysql /usr/bin
[root@backend-cxy bin]# mysql -p 
Enter password: 
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'NewPassword' WITH GRANT OPTION;
/etc/init.d/iptables stop
[root@backend-cxy bin]# netstat  -antp | grep 3306
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name           
tcp        0      0 :::3306                     :::*                        LISTEN      20723/mysqld        
[root@backend-cxy log]# netstat -anp | grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN      20723/mysqld        
tcp        0      0 ::ffff:192.168.0.13:3306    ::ffff:192.168.1.55:59516   ESTABLISHED 20723/mysqld        
tcp        0      0 ::ffff:192.168.0.13:3306    ::ffff:192.168.1.55:59248   ESTABLISHED 20723/mysqld           
CREATE USER demo IDENTIFIED BY “123456” 
允许用户jack从ip为10.10.50.127的主机连接到mysql服务器,并使用654321作为密码
mysql>GRANT ALL PRIVILEGES ON *.* TO 'jack'@’10.10.50.127’ IDENTIFIED BY '654321' WITH GRANT OPTION;
mysql>GRANT ALL PRIVILEGES ON shandong.* TO 'demo'@'%'WITH GRANT OPTION 
上一篇下一篇

猜你喜欢

热点阅读