1.安装

CentOS下先卸载自带的mariadb

rpm -qa | grep mariadb

mariadb-libs-5.5.-.el7_2.x86_64
mariadb-5.5.-.el7_2.x86_64
mariadb-server-5.5.-.el7_2.x86_64 rpm -e --nodeps mariadb-libs-5.5.-.el7_2.x86_64
rpm -ivh mysql-community-common-5.7.-.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.-.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.-.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.-.el6.x86_64.rpm

2.密码修改

# service mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root -pmysql

mysql> UPDATE user SET Password=PASSWORD('welcome1') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p

如果出现Unknown column 'password' in 'field list'

修改语句

update mysql.user set authentication_string=password('welcome1') where user='root'

3.建表

mysql> create database mydb;
Query OK, row affected (0.02 sec)
mysql> use mydb;
Database changed
mysql> create table student(stuID char(),stuName char());
Query OK, rows affected (0.08 sec)
mysql>insert into student values('abc','jack');
Query OK, row affected (0.03 sec)

4.远程连接端口,基于命令查看

show global variables like 'port';

修改/etc/my.cnf文件

[root@master ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
port=
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

5.远程连接的权限问题

tomcat端报错

数据库端错误运行授权出错

mysql> grant all privileges on *.* to 'root'@'%' with grant option;
ERROR (HY000): Your password does not satisfy the current policy requirements

Your password does not satisfy the current policy requirements

解决方法:

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, row affected (0.01 sec)
Rows matched: Changed: Warnings: mysql> FLUSH PRIVILEGES;
Query OK, rows affected (0.00 sec)

几经周折,调通收场。明天折腾搬上Kubernetes环境

折腾mysql的小坑记录的更多相关文章

  1. Win10自带Ubuntu子系统下Mysql安装踩坑记录

    linux系统为win10自带Ubuntu子系统 错误的安装过程 我按照一般的方法安装mysql,安装步骤如下 1.升级源 $ sudo apt-get update 2.安装mysql $ sudo ...

  2. flask 链接mysql数据库 小坑

    #config.py MYSQL_NAME = 'root' MYSQL_PASSWORD = 'zyms90bdcs' MYSQL_HOST = 'xxxx' MYSQL_POST = ' MYSQ ...

  3. jquery事件委托遇到的小坑记录

    <script type="text/javascript" src="../../lib/jquery-1.11.2.min.js"></s ...

  4. CentOS安装时小坑记录

    在安装CentOS的时候,由于第一次安装小白,将VM虚拟机的内存设置为512M,导致进行安装的时候无法进入正常的画面安装模式,只能使用简版安装界面,可能对于很多小白不是很熟悉,特此记录,安装CentO ...

  5. ionic3.x开发小坑记录(一)

    自定义font的时候,在assets中创建的文件夹名字别用fonts,会与ionic默认样式冲突,在浏览器中调试是正常的,到手机上就出问题了. 在html中写img的src直接如图  assets前面 ...

  6. Elasticsearch之match_phrase小坑记录

    1.问题抛出 某个词组在Elasitcsearch中的某个document中存在,就一定通过某种匹配方式把它搜出来. 举例: title=公路局正在治理解放大道路面积水问题. 输入关键词:道路,能否搜 ...

  7. php 小坑记录

    1 empty  PHP<=5.5不能用于判断一个表达式的执行结果并且netbeans 和eclipse编辑器识别不出来此错误 含有此用法的 类 和页面将会报错 empty($this-> ...

  8. 复杂业务下向Mysql导入30万条数据代码优化的踩坑记录

    从毕业到现在第一次接触到超过30万条数据导入MySQL的场景(有点low),就是在顺丰公司接入我司EMM产品时需要将AD中的员工数据导入MySQL中,因此楼主负责的模块connector就派上了用场. ...

  9. 微信小程序开发技巧及填坑记录

    以下是自己在开发过程中遇到的坑和小技巧,记录以下: 1.出现了 page[pages/XXX/XXX] not found.May be caused by :1. Forgot to add pag ...

随机推荐

  1. JQuery判断一个元素下面是否有内容或者有某个标签

    网站开发时,我们时常需要把没有内容的标签隐藏或者去掉.在用JQ有两种好的解决办法: 一.判断文本是否为空 var jqObj = $(this);if(jqObj.text().trim()){ // ...

  2. Leetcode 之Flatten Binary Tree to Linked List(50)

    将左子树接到右子树之前,递归解决 void flatten(TreeNode *root) { if (root == nullptr)return; flatten(root->left); ...

  3. selenium 参数传递(testng.xml 、DataProvider )

    为了方便测试代码的复用性,常常采用参数化.传递参数给测试代码 有一下两种方法:1.通过配置XML文件实现.2.通过DataProvider 传递参数. 注意:DataProvider 传递参数返回的是 ...

  4. hdu 3435(KM算法最优匹配)

    A new Graph Game Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. ios 安卓 video 取消播放自动全屏 属性

    x-webkit-airplay="true",x5-playsinline="true",webkit-playsinline="true" ...

  6. 简单的WSGI server

    参考:https://ruslanspivak.com/lsbaws-part1/ 简单的WSGI server server程序 webserver.py # Tested with Python ...

  7. 运行hadoop的时候提示物理内存或虚拟内存溢出的解决方案running beyond physical memory或者beyond vitual memory limits

    当运行中出现Container is running beyond physical memory这个问题出现主要是因为物理内存不足导致的,在执行mapreduce的时候,每个map和reduce都有 ...

  8. 牛客练习赛 29 E 位运算?位运算!(线段树)

    题目链接  牛客练习赛29E 对$20$位分别建立线段树.首先$1$和$2$可以合起来搞(左移右移其实是等效的) 用个lazy标记下.转移的时候加个中间变量. $3$和$4$其实就是区间$01$覆盖操 ...

  9. CodeForces 779A Pupils Redistribution

    简单题. 因为需要连边的人的个数一样,又要保证和一样,所以必须每个数字的个数都是一样的. #include<map> #include<set> #include<cti ...

  10. matlab学习之绘制参数曲线,添加辅助线以及颜色设置

    粘贴代码 % 插入参数曲线h % 插入辅助线h1 % 并设置颜色,包括画布颜色和曲线颜色 t=-pi:0.1:pi; x=cos(t)-sin(3*t); y=sin(t).*cos(t)-cos(3 ...