折腾mysql的小坑记录
2024-10-21 23:09:00
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环境
最新文章
- 详解 Android Activity 生命周期
- 真有用?Snap和Flatpak 通吃所有发行版的打包方式。
- c++ 中 delete p与 delete []p的区别
- 2016年11月24日 星期四 --出埃及记 Exodus 20:15
- 关于以DataTable形式批量写入数据的案例
- Retrofit研究1
- (转)Java Socket编程
- PHP常见错误
- 《HelloGitHub》第 28 期
- 关于C#chart图表实现多条折线动态绑定数据的问题
- [luogu3391][文艺平衡树]
- Day8 函数指针做函数参数
- java 标签编译后没有显示
- Java知多少(81)框架窗口基础
- jmeter源码导入eclipse并执行
- python3+unittest+HTMLTestRunner
- 定时执行任务FluentScheduler
- 深入理解Linux网络技术内幕——PCI层和网络接口卡
- mvc权限验证--AuthorizeAttribute
- FlashBuilder 4.6序列号破解
热门文章
- 【python】资料记录
- P2725 邮票 Stamps(完全背包+限制填充数)
- LeetCode解题报告—— 4Sum &; Remove Nth Node From End of List &; Generate Parentheses
- Hadoop 学习【一】 安装部署
- Java数组的十大方法
- python初步入门
- 洛谷P3216 [HNOI2011] 数学作业 [矩阵加速,数论]
- UTF-8 与 BIG-5 转码
- 在intellij idea 中进行android 单元测试
- [BZOJ2726][SDOI2012]任务安排(DP+凸壳二分)