mysql_aarch安装-超详细
下载链接:https://pan.baidu.com/s/1cA6gSMqemxW1tfcvbIWpIg
提取码:mysq
1.添加mysql用户
# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql2.解压mysql
# tar xf mysql-5.7.27-aarch64.tar.gz -C /home# cd /home
# mv mysql-5.7.27-aarch64 mysql
# cd /home/mysql
# mkdir data
# chown -R mysql:mysql /home/mysql
# cp -rf /home/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
3.设置开机启动
# cp -rf /home/mysql/support-files/mysql.server /etc/init.d/mysqld# systemctl enable mysqld
4.添加环境变量
# vim /etc/profile添加下面两行代码:
export MYSQL_HOME=/home/mysql
export PATH=$PATH:$MYSQL_HOME/bin
# source /etc/profile
5.创建/etc/my.cnf
添加以下内容# vim my.cnf
[mysql]
socket=/home/mysql/mysql.sock
# set mysql client default chararter
default-character-set=utf8
[mysqld]
socket=/home/mysql/mysql.sock
# set mysql server port
port = 3306 # 默认是3306,如果这里发现3306已经被占用,可以更改
# set mysql install base dir
basedir=/home/mysql
# set the data store dir
datadir=/home/mysql/data/
# set the number of allow max connnection
max_connections=1024
# set server charactre default encoding
character-set-server=utf8
# the storage engine
default-storage-engine=INNODB
# 设置MySQL对表名等不区分大小写
lower_case_table_names=1
max_allowed_packet=200M
explicit_defaults_for_timestamp=true
#阻止过多尝试失败的客户端以防止暴力破解密码的情况,与性能并无太大的关系
max_connect_errors=30
#此参数确定数据日志文件的大小,以M为单位,根据数据更新频率调整。
innodb_log_file_size=50
#指定大小的内存来缓冲数据和索引,最大可以把该值设置成物理内存的80%
innodb_buffer_pool_size=10G
key_buffer_size=16M
sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
log-bin=mysql-bin #添加这一行就ok
binlog-format=ROW #选择row模式
server_id=1 #配置mysql replaction需要定义,不能和canal的slaveId重复
expire_logs_days=3 #日志的保存天数
[mysql.server]
user=mysql
basedir=/home/mysql
#可以防止出现插入中文报错;如果此时不生效,可以强制在创建表的时候指定使用utf8的编码集
[client]
default-character-set = utf8
6.初始化启动mysql
# 无密码初始化登录
# bin/mysqld --initialize-insecure --user=mysql --basedir=/home/mysql/ --datadir=/home/mysql/data/
!!!执行这里出现错误:
查看mysql目录是否生成my.cnf
删除自动生成的my.cnf,数据库会优先读取自身目录的my.cnf
# rm -rf /home/mysql/my.cnf
继续初始化操作
# bin/mysqld --initialize-insecure --user=mysql --basedir=/home/mysql/ --datadir=/home/mysql/data/
初始化成功
7.启动mysql
# systemctl restart mysqld# systemctl status mysqld
8.登录mysql
mysql -uroot -p 回车#root本地设置密码
mysql> SET PASSWORD = PASSWORD('123456');
mysql> FLUSH PRIVILEGES;
9. 新建普通用户
root只能本地连接mysql> grant all on *.* to deploy@'%' identified by '123456';
mysql> use mysql
mysql> select user,host from user;