赞
踩
- tar -xvf 可以解压tar.xz后缀的压缩文件
- tar -zxvf 可以解压tar.gz后缀的压缩文件
(以下以mysql-8.0.32-linux-glibc2.17-aarch64.tar.gz为例)
- 1、解压:
- tar -zxvf mysql-8.0.32-linux-glibc2.17-aarch64.tar.gz
- 2、重命名
- mv mysql-8.0.32-linux-glibc2.17-aarch64 mysql-8.0.32
- 3、创建data文件夹 储存文件
- cd mysql-8.0.32
- mkdir data
- 4、创建用户组和用户
- groupadd mysql
- useradd -g mysql mysql
- 5、授权用户
- chown -R mysql.mysql /usr/local/soft/mysql-8.0.32
- 6、mysql初始化(注意这里会生成密码,记得保存)
- cd bin
- ./mysqld --user=mysql --basedir=/usr/local/mysql-8.0.32 --datadir=/usr/local/mysql-8.0.32/data/ --initialize
- (注:如果报错
- ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
- -bash: ./mysqld:: 没有那个文件或目录
- 则执行: yum install -y libaio
- 参考:https://blog.csdn.net/ycsdn10/article/details/121934412
- )
- 然后再执行一次初始化
- 7、编辑my.cnf
- vim /etc/my.cnf

=====================下面是修改后的====================
- [[mysqld]
- #datadir=/var/lib/mysql 【修改点】
- datadir=/usr/local/mysql-8.0.19/data
- #【修改点】
- basedir=/usr/local/mysql-8.0.19
- 【修改点】
- #socket=/var/lib/mysql/mysql.sock
- socket=/tmp/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/mariadb/mariadb.log
- 【修改点】
- #pid-file=/var/run/mariadb/mariadb.pid
-
- #
-
- include all files from the config directory
-
- #
- !includedir /etc/my.cnf.d

- 8、添加mysqld服务
- 返回mysql-8.0目录下,添加mysqld服务到系统
- cp -a ./support-files/mysql.server /etc/init.d/mysql
- 9.授权以及添加服务
- chmod +x /etc/init.d/mysql
- chkconfig --add mysql
- 10.启动mysql
- service mysql start
- 11.查看启动状态
- service mysql status
- 12.将mysql命令添加到服务
- ln -s /usr/local/mysql-8.0/bin/mysql /usr/bin
- 13.登录
- mysql -uroot -p
- 14.修改root密码
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
- flush privileges;
- 15.修改远程连接并生效
- use mysql;
- update user set host='%' where user='root';
- flush privileges;
- 16.开放防火墙3306端口
- firewall-cmd --add-port=3306/tcp --permanent
- firewall-cmd --reload
- 查看防火墙端口开放状态(看3306是否开启了)
- firewall-cmd --list-all

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。