1:依赖软件下载:
ftp://ftp.gnu.org/gnu/m4/2:此笔记使用版本:
http://ftp.gnu.org/gnu/bison/
https://cmake.org/download/
ftp://invisible-island.net/ncurses/
http://ftp.kaist.ac.kr/mysql/Downloads/
m4-1.4.17.tar.gz3:安装依赖:
bison-3.0.tar.gz
ncurses-6.0.tar.gz
cmake-3.3.2.tar.gz
mysql-5.6.33.tar.gz
m4:
tar zxvf m4-1.4.17.tar.gzbison:
cd m4-1.4.17
./configure
make && make install
man m4
tar zxvf bison-3.0.tar.gzncurses:
cd bison-3.0
./configure
make && make install
man bison
tar zxvf ncurses-6.0.tar.gzcmake:
cd ncurses-6.0
./configure
make && make install
man ncurses
tar zxvf cmake-3.3.2.tar.gz
cd cmake-3.3.2
./bootstrap
make && make install
cmake --version
3:源码安装mysql数据库:
①:安装目录和数据目录:
mkdir -p /usr/local/mysql②:用户和组:
mkdir /data
grep mysql /etc/group③:cmake编译工具编译mysql源代码:
grep mysql /etc/passwd
groupadd mysql
useradd mysql -g mysql -d /usr/local/mysql -s /bin/sh
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_bin -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1注: 详细参数参考
④:编译和安装
make && make install注:建议磁盘大小:30G以上,安装编译安装前可以:make test :检查安装最佳。
⑤:进入安装目录下,初始化MySQL数据库:
cd /usr/local/mysql⑥:配置mysql配置文件:
./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data --user=mysql
cp -R my.cnf /etc/注:简单配置如下:
[client]⑦:目录文件都属于mysql用户:
port = 3306
socket = /data/mysql.sock
[mysqld]
basedir = /usr/local/mysql
datadir = /data
port = 3306
socket = /data/mysql.sock
log-error = /data/mysql-error.log
pid-file = /data/mysql.pid
user = mysql
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
chown -R mysql.mysql /usr/local/mysql/⑧:启动mysql数据库:
chown -R mysql.mysql /data
chown -R mysql.mysql /etc/my.cnf
cd support-files/⑨:使用mysql客户端命令-配置mysql 环境变量:
./mysql.server start
cp -R mysql.server /etc/init.d/mysqld
chown -R mysql.mysql mysqld
service mysqld start
vim /etc/profile
#mysqlexport MYSQL_HOME=/usr/local/mysqlexport PATH=$MYSQL_HOME/bin:$PATH
source /etc/profile此时可以直接在命令行输入:mysql ,启动客户端。
⑩:设置mysql登录名和密码和权限:
root@root:/usr/local/mysql# mysql
mysql>grant all on *.* to usernamexxx@'10.188.1.%' Identified by 'ipasswordxx123';