标签:log lin 用户 yum 初始化 down ted 安装路径 ide
安装依赖库yum -y install gcc gcc-c++ zlib zlib-devel ncurses ncurses-devel libaio libaio-devel
wget https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0/mysql-8.0.20-el7-x86_64.tar.gz
tar -zxf mysql-8.0.20-el7-x86_64.tar.gz
mkdir -p /usr/local/mysql/data
useradd mysql -s /sbin/nologin -M
chown -R mysql.mysql /usr/local/mysql/
cp -r mysql-8.0.20-el7-x86_64/* /usr/local/mysql/
1、cd /usr/local/mysql
2、./bin/mysqld --initialize --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
注意:初始化后,最后一行的末尾会有一个随机生成的root密码,请记下!!!!!
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
#socket=/var/lib/mysql/mysql.sock
#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
[mysqld_safe]
log-error=/var/log/mysql-error.log
#pid-file=/var/run/mariadb/mariadb.pid
#include all files from the config directory
!includedir /etc/my.cnf.d
/usr/local/mysql/support-files/mysql.server start
登录:/usr/local/mysql/bin/mysql -uroot -p
更改密码:
mysql> alter user ‘root‘@‘localhost‘ identified by ‘123456p‘;
Query OK, 0 rows affected (0.00 sec)
刷新权限:
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
标签:log lin 用户 yum 初始化 down ted 安装路径 ide
原文地址:https://blog.51cto.com/6461704/2551958