xcd /usr/local
sudo wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
xxxxxxxxxx
tar -zxvf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
xxxxxxxxxx
apt-cache search libaio # search for info
apt-get install libaio1 # install library
1创建一个新的工作mysql组, 新工作组的信息将被添加到系统文件中
xxxxxxxxxx
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
建立软链接
xxxxxxxxxx
ln -s /usr/local/mysql-5.7.35-linux-glibc2.12-x86_64 mysql
xxxxxxxxxx
cd mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql
bin/mysql_ssl_rsa_setup
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
xxxxxxxxxx
mysql -uroot -p
xxxxxxxxxx
alter user 'root'@'localhost' identified by '你的密码';
创建 root 账号允许远程登录,并授予所有权限。
xxxxxxxxxx
CREATE USER 'root'@'%' IDENTIFIED BY '你的密码';
GRANT ALL ON *.* TO 'root'@'%';
xxxxxxxxxx
exit;
\quit
\q
xxxxxxxxxx
service mysql.server start
xxxxxxxxxx
service mysql.server stop
xxxxxxxxxx
service mysql.server stop;
进入到mysql文件夹(压缩包解压的文件夹)
xxxxxxxxxx
# ln -s /usr/local/mysql-5.7.35-linux-glibc2.12-x86_64 mysql #这是我之前建立的软链接
cd /usr/local/mysql
查询my.cnf文件
xxxxxxxxxx
bin/mysqld --help --verbose | grep my.cnf
查询结果
进入第一个配置文件添加 skip-grant-tables,使登录时跳过权限检查;
xxxxxxxxxx
sudo vim /etc/my.cnf
xxxxxxxxxx
service mysql.server start;
xxxxxxxxxx
mysql -uroot -p
1、刷新MySQL权限相关的表
xxxxxxxxxx
flush privileges;
2、修改密码
xxxxxxxxxx
alter user 'root'@'localhost' identified by '你的密码';
3、刷新MySQL权限相关的表
xxxxxxxxxx
flush privileges;
xxxxxxxxxx
exit;