标签:新建 with war eve out emd mys sed pre
#下载Mysql5.6#安装依赖包yum install -y gcc gcc-c++ make tar openssl openssl-devel cmake ncureses ncurses-devel
#新建mysql用户useradd -s /sbin/nologin mysql
#解压并编译
tar -zxvf
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH-EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
make && make install
#配置环境变量
vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
#更新配置
vim /etc/my.cnf
[mysqld]
bind-address=0.0.0.0
port=3306
datadir=/data/mysql
user=mysql
skip-name-resolve
long_query_time=2
slow_query_log_file=/data/mysql/mysql-slow.log
expire_logs_days=2
innodb-file-per-table=1
innodb_flush_log_at_trx_commit=2
log_warnings=1
max_allowed_packet=512M
connect_timeout=60
net_read_timeout=120
[mysql]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character_set_server=utf8
[mysqld_safe]
log-error=/data/mysql/mysqld.log
pid-file=/data/mysql/mysqld.pid
#创建目录并修改属主
mkdir -pv /data/mysql
chown -R mysql:mysql /usr/local/mysql/ /data/mysql/
#安装
yum install -y perl-Module-Install
#数据库初始化:
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --user=mysql --datadir=/data/mysql/
#设置systemctl管理
vim /usr/lib/systemd/system/mysqld.service
#修改mysql root密码
mysqladmin -uroot -h 127.0.0.1 password ‘123456‘
#开启用户授权
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.0.%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
#登陆测试
mysql -h 192.168.0.1 -uroot -p123456 -A
标签:新建 with war eve out emd mys sed pre
原文地址:https://blog.51cto.com/ahaqwz/2428199