标签:syslog mysql用户 tail 连接mysql ystemd scripts serve 5.6 des
1.创建安装目录:
[root@db01 ~]# mkdir /application
2.下载二进制安装包:
wget https://downloads.mysql.com/archives/get/file/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
3.解压二进制包:
[root@db01 ~]# tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
4.移动解压目录
[root@db01 ~]# mv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40
5.做MySQL软连接
[root@db01 scripts]# ln -s /application/mysql-5.6.40/ /application/mysql
6.创建MySQL用户
[root@db01 ~]# useradd mysql -s /sbin/nologin -M
7.进入配置文件及启动脚本目录
[root@db01 ~]# cd /application/mysql-5.6.40/support-files
8.拷贝配置文件到/etc/my.cnf
[root@db01 support-files]# cp my-default.cnf /etc/my.cnf
9.拷贝启动脚本
[root@db01 support-files]# cp mysql.server /etc/init.d/mysqld
10.初始化MySQL
[root@db01 scripts]# cd /application/mysql-5.6.40/scripts
[root@db01 scripts]# ./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
--user 指定mysql用户
--basedir 指定mysql安装目录
--datadir 指定mysql数据目录
11.修改MySQL启动脚本及启动程序
[root@db01 scripts]# sed -i ‘s#/usr/local#/application#g‘ /etc/init.d/mysql /application/mysql/bin/mysqld_safe
12.启动MySQL
[root@db01 scripts]# /etc/init.d/mysqld start
13.添加环境变量
[root@db01 scripts]# echo ‘export PATH="/application/mysql/bin:$PATH"‘ > /etc/profile.d/mysql.sh
14.加载环境变量
[root@db01 scripts]# source /etc/profile
15.添加systemd启动
[root@db01 scripts]# vim /etc/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
MySQL查看报错:
[root@db01 scripts]# tail -100 /application/mysql/data/db01.err
连接MySQL:
[root@db01 scripts]# mysql
查看库:
mysql> show databases;
标签:syslog mysql用户 tail 连接mysql ystemd scripts serve 5.6 des
原文地址:https://www.cnblogs.com/fangdecheng/p/9997942.html