码迷,mamicode.com
首页 > 数据库 > 详细

linux安装MYSQL

时间:2019-01-08 21:13:09      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:tran   mode   bin   dde   lib   schema   reload   sql   linux安装   

yum install lrz* -y
#
yum -y install \
ncurses \
ncurses-devel \
bison \
cmake
#
useradd -s /sbin/nologin mysql
#
tar xf mysql-boost-5.7.20.tar.gz
#
cd mysql-5.7.20/
#
yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel
#
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1
#
make && make install
#
chown -R mysql.mysql /usr/local/mysql/
#
vi /etc/my.cnf
#最下面加
[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock

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

[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
character_set_server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
:wq

chown mysql:mysql /etc/my.cnf
#
echo ‘PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH‘ >>
#
/etc/profile
#
echo ‘export PATH‘ >> /etc/profile
#
source /etc/profile
#
cd /usr/local/mysql/
#
bin/mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
#
cp usr/lib/systemd/system/mysqld.service
#
/usr/lib/systemd/system/
#
systemctl daemon-reload
#
systemctl start mysqld
#
netstat -anpt | grep 3306
#
systemctl enable mysqld
#
mysqladmin -u root -p password "abc123" //给root账号设置密码
实验有没有成功
技术分享图片

linux安装MYSQL

标签:tran   mode   bin   dde   lib   schema   reload   sql   linux安装   

原文地址:http://blog.51cto.com/14158288/2340343

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!