期间报了一万个错,快崩溃了,最后终于弄好了,特意记录一下:

yum -y install ncurses ncurses-devel bison cmake
yum install -y gcc gcc-c++
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.27.tar.gz #mysql5.7源码安装需要boost,这个包下载自带boost
mkdir -p /weblogic/mysql/mysql
mkdir -p /weblogic/mysql/datadir

以下整段为配置的命令

cmake . 
-DCMAKE_INSTALL_PREFIX=/weblogic/mysql/mysql -DMYSQL_DATADIR=/weblogic/mysql/datadir -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/my/mysql-5.7.27/boost -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

 

修改/etc/my.cnf

[mysqld]
user=mysql
basedir=/weblogic/mysql/mysql
datadir=/data/mysql
pid-file=/usr/local/mysql/mysql.pid
socket=/usr/local/mysql/mysql.sock


[mysqld_safe]
log-error=/usr/local/mysql/logs/mysqld.log
pid-file=/usr/local/mysql/pids/mysqld.pid

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[client]
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock

[mysql]
default-character-set=utf8
socket=/usr/local/mysql/mysql.sock

创建配置文件中用到的而你系统中没有的目录

初始化mysql

./mysqld --initialize --user=mysql --basedir=/weblogic/mysql/mysql --datadir=/data/mysql

这一步执行完mysql会给出一个默认密码,需要记住

 

把mysql.server复制到服务列表,并添加执行权限,方便管理

cp /weblogic/mysql/mysql/support-files/mysql.server /etc/init.d/msyqld
chmod +x /etc/init.d/msyqld

把mysql的bin目录添加到环境变量,方便使用

export PATH=/weblogic/mysql/mysql/bin:$PATH添加到/etc/profile最后一行,并且启用
source /etc/profile

启动服务

serivce mysqld start

 修改密码

mysqladmin -uroot -p你的初始密码 password

输入两次新密码后,密码修改完成

mysql -uroot -p你的新密码

登录后,开启数据库远程访问权限

grant all privileges  on *.* to root@'%' identified by "你的mysql密码";
flush privileges;

之后就可以随便用了

posted on 2019-08-16 11:26  盈盈的月儿  阅读(1499)  评论(0编辑  收藏  举报