linux arm下安装mysql
程序员文章站
2022-03-03 14:46:30
...
linux arm下安装mysql
2.1 获取mysql安装包
从https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0/mysql-8.0.23-1.el7.aarch64.rpm-bundle.tar下载安装包,放到/opt/rpm目录下,使用tar -xvf
解压
2.2 使用rpm安装mysql
yum install -y perl-JSON
yum install -y perl-Test-Simple
rpm -e mariadb-libs --nodeps
rpm -ivh mysql-community-common-8.0.23-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-plugins-8.0.23-1.el7.aarch64.rpm
rpm -ivh mysql-community-libs-8.0.23-1.el7.aarch64.rpm
rpm -ivh mysql-community-client-8.0.23-1.el7.aarch64.rpm
rpm -ivh mysql-community-server-8.0.23-1.el7.aarch64.rpm
2.3 配置mysql
2.3.1 关闭selinux
- 临时关闭
setenforce 0
- 永久关闭
编辑/etc/sysconfig/selinux
vim /etc/sysconfig/selinux
- 然后将配置SELinux=enforcing改为SELinux=disabled,如下图所示。
SELINUX=disabled
2.3.2 配置mysql
- 创建mysql的数据目录,并把此目前权限赋给mysql用户及用户组
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
- 配置/etc/my.cnf,注意把innodb_buffer_pool_size设置成机器内存的70%左右
[client]
port = 3306
host = localhost
socket =/data/mysql/mysql.sock
[mysqld]
# Base Config
#server_id = 882137661
datadir =/data/mysql
socket =/data/mysql/mysql.sock
port = 3306
character_set_server = utf8
skip_slave_start = 1
skip-name-resolve = 1
skip-external-locking = 1
lower_case_table_names = 1
max_connections = 1000
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
# InnoDB config
#innodb_strict_mode = 1
#innodb_file_per_table = 1
#innodb_stats_on_metadata = 0
#innodb_flush_method = O_DIRECT
#innodb_log_files_in_group = 3
#innodb_data_file_path = ibdata1:1G:autoextend
innodb_buffer_pool_size = 20G
#innodb_max_dirty_pages_pct = 60
#innodb_io_capacity = 400
#innodb_buffer_pool_instances = 8
#innodb_buffer_pool_load_at_startup = 1
#innodb_buffer_pool_dump_at_shutdown = 1
#innodb_undo_logs = 128
#innodb_undo_tablespaces = 3
#innodb_thread_concurrency = 4
innodb_open_files = 65536
innodb_io_capacity =400
innodb_doublewrite = OFF
innodb_flush_method=O_DIRECT
# Cache config
key_buffer_size = 2048M
tmp_table_size = 512M
max_heap_table_size = 256M
thread_cache_size = 64
table_open_cache = 128
open_files_limit = 65535
max_allowed_packet = 256M
#####################用户进程分配到的内存设置BEGIN#############################
##每个session将会分配参数设置的内存大小
#用于表的顺序扫描,读出的数据暂存于read_buffer_size中,当buff满时或读完,将数据返回上层调用者
#一般在128kb ~ 256kb,用于MyISAM
read_buffer_size = 256M
#用于表的随机读取,当按照一个非索引字段排序读取时会用到,
#一般在128kb ~ 256kb,用于MyISAM
read_rnd_buffer_size = 512M
#order by或group by时用到
#建议先调整为2M,后期观察调整
join_buffer_size = 2048M
sort_buffer_size = 1024M
#一般数据库中没什么大的事务,设成1~2M,默认32kb
#binlog_cache_size = 524288
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Log config
#relay-log = mysql-relay
#log-bin = mysql-bin
#slow_query_log = 1
#long_query_time = 2
log_slow_admin_statements = 1
log_slow_slave_statements = 1
lock_wait_timeout = 1800
- 启动mysql,并设置成开机自启动
systemctl start mysqld
systemctl enable mysqld
2.3.3 修改root的密码
-
在
/etc/mysql.cnf
的[mysqld]
后面添加skip-grant-table
-
重启mysql服务
systemctl restart mysqld
-
进入数据库
mysql -u root -p
直接敲回车
输入一下代码
use mysql; -- 解决在`skip-grant-table`下不能修改密码的问题 update user set authentication_string='' where user='root'; -- 刷新权限 flush privileges; -- 设置验证密码规则为简单模式 set GLOBAL validate_password.policy=LOW; -- 设置密码长度为6位 set global validate_password.length=6; -- 设置root可以让任何ip访问 update user set user.Host='%' where user.User='root'; -- 设置密码永不过期 ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; -- 设置密码为123456 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; -- 刷新权限 flush privileges; -- 退出 quit;
-
在
/etc/mysql.cnf
的[mysqld]
后面删除skip-grant-table
-
重启mysql服务
systemctl restart mysqld
-
可以使用
mysql -u root -p -h <mysql服务器的ip>
命令,然后数据密码是否能够登陆。
上一篇: Docker 安装
下一篇: Zhong__CentOS下载离线安装包
推荐阅读
-
Linux中XAMPP套件下MySQL有关问题
-
Oracle 10g RAC 在Linux下安装经验总结
-
Oracle Linux 6.3下安装Oracle 11g R2(11.2.0.3)
-
Linux源码安装mysql 5.5.13 (cmake编译)
-
Linux下安装PHP 5.4.3(以Apache为WebServer)
-
centos 6.4下使用rpm离线安装mysql
-
linux下Nginx 0.8.40的安装方法
-
在Windows下安装MySQL的图形管理工具phpMyAdmin_PHP
-
Linux下MySql出现#1036 – Table ‘ ‘ is read only 错误解决方_MySQL
-
Windows XP下全新安装Apache2,PHP5,MYSQL5,Zend的简单过程_PHP