安裝系統:CentOS7.7_x64
Mysql版本:mysql-5.6.38.tar.gz
Cmake版本:cmake-2.8.4.tar.gz
[root@c7-45 ~]# yum -y install gcc gcc-c++ bison ncurses ncurses-devel boost
1.安裝依賴包
[root@c7-45 ~]# ls
anaconda-ks.cfg cmake-2.8.4.tar.gz mysql-5.6.38.tar.gz
2.上傳安裝包
[root@c7-45 ~]# ls
cmake-2.8.4.tar.gz mysql-5.6.38.tar.gz
3.安裝cmake
[root@c7-45 ~]# tar zxf cmake-2.8.4.tar.gz
[root@c7-45 ~]# cd cmake-2.8.4/
[root@c7-45 cmake-2.8.4]# ./configure
[root@c7-45 cmake-2.8.4]# make && make install
[root@c7-45 cmake-2.8.4]# cmake -version
cmake version 2.8.4
4.安裝mysql
[root@c7-45 ~]# useradd mysql
[root@c7-45 cmake-2.8.4]# cd
[root@c7-45 ~]# tar zxf mysql-5.6.38.tar.gz
[root@c7-45 ~]# cd mysql-5.6.38/
[root@c7-45 mysql-5.6.38]# cmake .
[root@c7-45 mysql-5.6.38]# make && make install
5.Mysql初始化
[root@c7-45 mysql-5.6.38]# chown -R mysql.mysql /usr/local/mysql/
[root@c7-45 mysql-5.6.38]# cd /usr/local/mysql/scripts/
[root@c7-45 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
6.給mysql提供配置文件:
[root@c7-45 scripts]# cd /usr/local/mysql/data/
[root@c7-45 data]# cd /usr/local/mysql/
[root@c7-45 mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? yes
[root@c7-45 mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@c7-45 mysql]# service mysqld start
Starting MySQL.Logging to '/usr/local/mysql/data/c7-45.err'.
SUCCESS!
[root@c7-45 mysql]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@c7-45 mysql]# ps -ef | grep mysqld
[root@c7-45 mysql]# ss -ntlp |grep 3306
[root@c7-45 mysql]# chkconfig --add mysqld
[root@c7-45 mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.38 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
#5.7以下版本默認情況下root用戶沒有密碼,可以直接登錄
7.給root設置密碼
6
Warning: Using a password on the command line interface can be insecure.
[root@c7-45 mysql]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@c7-45 mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.38 Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>