鲲鹏服务器、ARM架构Ubuntu18.04.3系统安装MySQL并修改数据目录

本文主要是介绍鲲鹏服务器、ARM架构Ubuntu18.04.3系统安装MySQL并修改数据目录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

  • 第一次用Ubuntu安装MySQL 真是各种坑。。。。
  • Ubuntu系统安装MySQL 修改MySQL默认数据目录/var/lib/mysql
  1. 安装MySQL
apt-get update
apt-get install mysql-server -y
  1. 查看MySQL是否安装成功
#安装好以后默认是启动的
root@test-server02:/opt# systemctl status mysql
· mysql.service - MySQL Community ServerLoaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2024-08-20 13:55:49 CST; 1min 34s agoMain PID: 10728 (mysqld)Tasks: 27 (limit: 4915)CGroup: /system.slice/mysql.service└─10728 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Aug 20 13:55:49 sdgs-server02 systemd[1]: Starting MySQL Community Server...
Aug 20 13:55:49 sdgs-server02 systemd[1]: Started MySQL Community Server.
#登录以后默认没有密码 这个就很坑 还以为和centos一样设置密码就行
root@test-server02:/opt# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
  1. 修改MySQL配置文件
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address           = 127.0.0.1
#注释掉上面的配置、这个不注释根本连不上
max_connections=1000
#放开此参数,修改成1000 这个是研发需求
  1. 修改MySQL数据目录
#停掉MySQL
systemctl stop mysql
#移动MySQL默认数据目录:/var/lib/mysql
root@test-server02:~# cd /var/lib/
root@test-server02:/var/lib# mv mysql /opt/
#修改MySQL配置
vim /etc/mysql/mysql.conf.d/mysqld.cnf
datadir         = /opt/mysql
#修改上面配置
#授予权限
chown -R mysql.mysql /opt/mysql
修改apparmor配置
vim /etc/apparmor.d/usr.sbin.mysqld# Allow data dir access/opt/mysql/ r,/opt/mysql/** rwk,
#找到上面这两处进行修改#重启apparmor服务
systemctl restart apparmor
#启动MySQL
root@test-server02:/opt/mysql# systemctl restart mysql
root@test-server02:/opt/mysql# systemctl status mysql
· mysql.service - MySQL Community ServerLoaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2024-08-20 15:07:41 CST; 8s agoProcess: 26099 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)Process: 26080 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)Main PID: 26101 (mysqld)Tasks: 27 (limit: 4915)CGroup: /system.slice/mysql.service└─26101 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Aug 20 15:07:41 sdgs-server02 systemd[1]: Starting MySQL Community Server...
Aug 20 15:07:41 sdgs-server02 systemd[1]: Started MySQL Community Server.
root@sdgs-server02:/opt/mysql# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SHOW VARIABLES LIKE 'datadir';
+---------------+-------------+
| Variable_name | Value       |
+---------------+-------------+
| datadir       | /opt/mysql/ |
+---------------+-------------+
1 row in set (0.00 sec)
mysql>
  1. 修改MySQL密码&&赋予远程访问权限

这一块是最坑的,由于第一次安装不知道,修改密码的时候直接使用mysql命令即可、不要用mysql -uroot、这样改了以后不生效、更不要听网上的删掉root用户然后重新建更不行

root@test-server02:~# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'sdgs123456';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'sdgs123456';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@localhost IDENTIFIED BY 'sdgs123456';
#新开一个窗口测试

这篇关于鲲鹏服务器、ARM架构Ubuntu18.04.3系统安装MySQL并修改数据目录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1094082

相关文章

mybatis的整体架构

mybatis的整体架构分为三层: 1.基础支持层 该层包括:数据源模块、事务管理模块、缓存模块、Binding模块、反射模块、类型转换模块、日志模块、资源加载模块、解析器模块 2.核心处理层 该层包括:配置解析、参数映射、SQL解析、SQL执行、结果集映射、插件 3.接口层 该层包括:SqlSession 基础支持层 该层保护mybatis的基础模块,它们为核心处理层提供了良好的支撑。

大模型研发全揭秘:客服工单数据标注的完整攻略

在人工智能(AI)领域,数据标注是模型训练过程中至关重要的一步。无论你是新手还是有经验的从业者,掌握数据标注的技术细节和常见问题的解决方案都能为你的AI项目增添不少价值。在电信运营商的客服系统中,工单数据是客户问题和解决方案的重要记录。通过对这些工单数据进行有效标注,不仅能够帮助提升客服自动化系统的智能化水平,还能优化客户服务流程,提高客户满意度。本文将详细介绍如何在电信运营商客服工单的背景下进行

SQL中的外键约束

外键约束用于表示两张表中的指标连接关系。外键约束的作用主要有以下三点: 1.确保子表中的某个字段(外键)只能引用父表中的有效记录2.主表中的列被删除时,子表中的关联列也会被删除3.主表中的列更新时,子表中的关联元素也会被更新 子表中的元素指向主表 以下是一个外键约束的实例展示

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

基于MySQL Binlog的Elasticsearch数据同步实践

一、为什么要做 随着马蜂窝的逐渐发展,我们的业务数据越来越多,单纯使用 MySQL 已经不能满足我们的数据查询需求,例如对于商品、订单等数据的多维度检索。 使用 Elasticsearch 存储业务数据可以很好的解决我们业务中的搜索需求。而数据进行异构存储后,随之而来的就是数据同步的问题。 二、现有方法及问题 对于数据同步,我们目前的解决方案是建立数据中间表。把需要检索的业务数据,统一放到一张M

百度/小米/滴滴/京东,中台架构比较

小米中台建设实践 01 小米的三大中台建设:业务+数据+技术 业务中台--从业务说起 在中台建设中,需要规范化的服务接口、一致整合化的数据、容器化的技术组件以及弹性的基础设施。并结合业务情况,判定是否真的需要中台。 小米参考了业界优秀的案例包括移动中台、数据中台、业务中台、技术中台等,再结合其业务发展历程及业务现状,整理了中台架构的核心方法论,一是企业如何共享服务,二是如何为业务提供便利。

服务器集群同步时间手记

1.时间服务器配置(必须root用户) (1)检查ntp是否安装 [root@node1 桌面]# rpm -qa|grep ntpntp-4.2.6p5-10.el6.centos.x86_64fontpackages-filesystem-1.41-1.1.el6.noarchntpdate-4.2.6p5-10.el6.centos.x86_64 (2)修改ntp配置文件 [r

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

Centos7安装Mongodb4

1、下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.1.tgz 2、解压 放到 /usr/local/ 目录下 tar -zxvf mongodb-linux-x86_64-rhel70-4.2.1.tgzmv mongodb-linux-x86_64-rhel70-4.2.1/