标签:code chown glibc sbin 进制 stop ini ras support
1 官网下载mysql-5.7.29-linux-glibc2.12-x86_64.tar.gzDependencies Resolved
3 useradd -M -s /sbin/nologin -r mysql //-M不创建主目录,-s /sbin/nologin不允许登录,-r创建的是系统用户
4 tar zxf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ //解压
cd /usr/local/
mv mysql-5.7.26-linux-glibc2.12-x86_64/ mysql
cd mysql
mkdir data //创建数据目录
chown -R mysql.mysql /usr/local/mysql/
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
//显示root@localhost第一次登录的随机密码 注意这里的秘密
[root@bogon mysql]# vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
socket=/usr/local/mysql/mysql.sock
character-set-server=utf8
log-error=/var/log/mysqld.log
pid-file=/tmp/mysqld.pid
[mysql]
socket=/usr/local/mysql/mysql.sock
[client]
socket=/usr/local/mysql/mysql.sock
环境变量的配置
[root@bogon mysql]# vi /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH
[root@bogon mysql]# source /etc/profile.d/mysql.sh
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
chmod +x /etc/init.d/mysqld
[root@bogon mysql]# /etc/init.d/mysqld stop
Shutting down MySQL.. SUCCESS!
[root@bogon mysql]#
mysql
mysql -uroot -p‘e>;Yl?WVp7Na‘
mysql> set password for root@localhost=password(‘123456‘);
标签:code chown glibc sbin 进制 stop ini ras support
原文地址:https://blog.51cto.com/study2008/2474683