博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
折腾mysql的小坑记录
阅读量:4973 次
发布时间:2019-06-12

本文共 2766 字,大约阅读时间需要 9 分钟。

 

1.安装

CentOS下先卸载自带的mariadb

rpm -qa | grep mariadbmariadb-libs-5.5.50-1.el7_2.x86_64mariadb-5.5.50-1.el7_2.x86_64mariadb-server-5.5.50-1.el7_2.x86_64rpm -e --nodeps mariadb-libs-5.5.50-1.el7_2.x86_64

 

rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpmrpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpmrpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpmrpm -ivh mysql-community-server-5.7.12-1.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, 1 row affected (0.02 sec)mysql> use mydb;Database changedmysql> create table student(stuID char(20),stuName char(20));Query OK, 0 rows affected (0.08 sec)mysql>insert into student values('abc','jack');  Query OK, 1 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 70% of total RAM for dedicated server, else 10%.# 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 = 2Mport=3306datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

 

 

 

5.远程连接的权限问题

tomcat端报错

 

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

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

解决方法:

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

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

 

转载于:https://www.cnblogs.com/ericnie/p/7835457.html

你可能感兴趣的文章
转:网页启用Gzip压缩 提高浏览速度
查看>>
poj 3321(树状数组)
查看>>
《Java程序设计》第六周学习总结
查看>>
Linux正则表达式
查看>>
Mysql tinyint长度为1时在java中被转化成boolean型
查看>>
【刷题】BZOJ 3930 [CQOI2015]选数
查看>>
SQL分页排序的实现与分页数据重复问题——以Oracle rownum为例
查看>>
nagios 自定义插件demo
查看>>
Azure 基础 : 使用 Automation 定时开机
查看>>
使用Vim normal 命令 修改可视块区域
查看>>
详细分享UICollectionView的自定义布局(瀑布流, 线性, 圆形...)
查看>>
visio的一些有用的方法
查看>>
js跨域问题
查看>>
Excel VBA
查看>>
java IO流
查看>>
Java反射之Bean修改更新属性值等工具类
查看>>
《图解CSS3——第2章 CSS3选择器-3》
查看>>
Exchange Server备份与恢复
查看>>
现在很火的答题赢钱游戏,让我来简单教你怎么做自动答题器
查看>>
转:细数国内市场智能语音开放平台有哪些?
查看>>