借鉴:
https://blog.csdn.net/YKWNDY/article/details/107025041
https://blog.csdn.net/weixin_41919735/article/details/122554337
cd /usr/local
将部署包:mysql-5.7.27-aarch64.tar.gz 上传到 /usr/local 下
tar xvf mysql-5.7.27-aarch64.tar.gz
mv /usr/local/mysql-5.7.27-aarch64 /usr/local/mysql
mkdir -p /usr/local/mysql/logs
ln -sf /usr/local/mysql/my.cnf /etc/my.cnf
cp -rf /usr/local/mysql/extra/lib* /usr/lib64/
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.old
ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
vim /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
source /etc/profile
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
systemctl start mysqld
systemctl status mysqld
移动文件 mv /usr/local/mysql-5.7.27-aarch64 /usr/local/mysql
创建logs目录 mkdir -p /usr/local/mysql/logs
ln -sf a b 建立软连接,b指向a:ln -sf /usr/local/mysql/my.cnf /etc/my.cnf
cp是linux里的拷贝命令-r 是用于目录拷贝时的递归操作-f 是强制覆盖:cp -rf /usr/local/mysql/extra/lib* /usr/lib64/
创建mysql组:ln -s /usr/lib64/libstdc++.so.6.0.24 /usr/lib64/libstdc++.so.6
创建mysql用户添加到mysql组:groupadd mysql && useradd -g mysql mysql
将/usr/loca/mysql目录包含所有的子目录和文件,所有者改变为root,所属组改变为mysql:chown -R mysql:mysql /usr/local/mysql
设置开机启动:
cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
systemctl enable mysqld
添加环境变量:
vim /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=PATH:PATH:PATH:MYSQL_HOME/bin
source /etc/profile
初始化mysql:mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
开启mysql:systemctl start mysqld
查看状态:systemctl status mysqld
网友评论