zoukankan      html  css  js  c++  java
  • Mysql常用设置

    初次安装mysql设置

    第一种方式:修改mysql的配置文件

    环境:centos7.4 , mysql5.7

    1、 vim /etc/my.cnf 在[mysqld]加入 skip-grant-tables 然后保存退出 然后重启mysql

    2、 ./etc/init.d/mysqld restart 登录

    3、 mysql -u root -p

    4、 5.7版本前的mysql运行: update user set password="你的密码" where user="用户"; 5.7版本后的mysql运行:update mysql.user set authentication_string=‘你的密码' where user='用户';

    5、 exit; #退出

    6 、编辑my.cnf文件删掉skip-grant-tables 这一行,然后重启MySQL,/etc/init.d/mysqld restart,否则MySQL仍能免密码登录

    第二种方式:查看日志获得初始默认密码

    1、cat /var/log/mysqld.log | grep password

    2 、mysql -u root -p输入密码

    3、 ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';

    Mysql 基础操作

    1、查询操作

    select count(*) from mysql.db
    select * from mysql.db
    select db.user from
    select * from mysql.db where host like '192.168.%';

    2、增加操作

    insert into db1.t1 values (1,'abc');

    3、修改操作

    update db1.t1 set name='aaa' where id=1;

    4、删除操作

    truncate table db1.t1;
    drop table db.t1;

  • 相关阅读:
    外感上吐下泻案
    口唇口腔紅肿案
    柴胡桂枝汤---刘渡舟
    肺结核病人外感咳嗽不止案
    下肢麻木案
    老年人全身皮肤瘙痒案
    眩晕案
    頑固头痛失眠案
    PHP 点阵5*7字体
    PHP workerMan tcp与webSocket 透传互通
  • 原文地址:https://www.cnblogs.com/bianjiangjiang/p/13558658.html
Copyright © 2011-2022 走看看