zoukankan      html  css  js  c++  java
  • 折腾mysql的小坑记录

    1.安装

    CentOS下先卸载自带的mariadb

    rpm -qa | grep mariadb
    
    mariadb-libs-5.5.50-1.el7_2.x86_64
    mariadb-5.5.50-1.el7_2.x86_64
    mariadb-server-5.5.50-1.el7_2.x86_64
    
    rpm -e --nodeps mariadb-libs-5.5.50-1.el7_2.x86_64
    rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm
    rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm
    
    rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
    rpm -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 changed
    mysql> 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 = 2M
    port=3306
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    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 1819 (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, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> FLUSH   PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)

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

  • 相关阅读:
    WPF 关于拖拽打开文件的注意事项
    asp.net core 3.1中对Mongodb BsonDocument的序列化和反序列化支持
    用百度webuploader分片上传大文件
    多线程学习笔记
    web.config数据库连接字符串加密
    Visual Studio 2010 常用快捷方式
    Team Foundation Server 2013 日常使用使用手册(四)分支与合并
    Team Foundation Server 2013 日常使用使用手册(三)上传新工程、创建任务、创建bug、设置预警
    Team Foundation Server 2013 日常使用使用手册(二)修改、签入、撤销、回滚、对比代码变更
    Team Foundation Server 2013 日常使用使用手册(一)-本地连接TFS、查看任务
  • 原文地址:https://www.cnblogs.com/ericnie/p/7835457.html
Copyright © 2011-2022 走看看