zoukankan      html  css  js  c++  java
  • Linux安装配置MySQL

    (1)参考连接

    http://www.cnblogs.com/hld123/p/6603967.html

    (2)查看一下是不是有mysql 5.5了

    [root@xiaofeibao /]# yum --enablerepo=remi,remi-test list mysql mysql-server
    已加载插件:fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base: mirror.bit.edu.cn
    * epel: mirrors.tuna.tsinghua.edu.cn
    * extras: mirror.bit.edu.cn
    * remi: mirrors.tuna.tsinghua.edu.cn
    * remi-safe: mirrors.tuna.tsinghua.edu.cn
    * remi-test: mirrors.tuna.tsinghua.edu.cn
    * updates: mirrors.btte.net
    remi | 2.9 kB 00:00
    remi/primary_db | 1.8 MB 00:00
    remi-test | 2.9 kB 00:00
    remi-test/primary_db | 538 kB 00:00
    已安装的软件包
    mysql.x86_64 5.5.57-1.el6.remi @remi
    mysql-server.x86_64 5.5.57-1.el6.remi @remi
    [root@xiaofeibao /]#

    (3)查找以前是否安装有mysql,使用下面命令:

    [root@xiaofeibao /]# rpm -qa|grep -i mysql
    mysql-libs-5.5.57-1.el6.remi.x86_64
    perl-DBD-MySQL-4.013-3.el6.x86_64
    mysql-5.5.57-1.el6.remi.x86_64
    php-mysqlnd-5.6.31-1.el6.remi.x86_64
    mysql-server-5.5.57-1.el6.remi.x86_64
    compat-mysql51-5.1.73-1.el6.remi.x86_64

     (4)登录mysql、设置密码、

    [root@xiaofeibao ~]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.5.57 MySQL Community Server (GPL) by Remi

    Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql>
    mysql>
    mysql>
    mysql>
    mysql> grant all privileges on *.* to 'root'@'%' identified by 'sa123456' with grant option;
    Query OK, 0 rows affected (0.01 sec)

    mysql>
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    (5)查表

    mysql> use admin;
    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> show tables;

    (6)删除用户名

    [root@xiaofeibao ~]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 12
    Server version: 5.5.57 MySQL Community Server (GPL) by Remi

    Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    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> desc user;
    +------------------------+-----------------------------------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +------------------------+-----------------------------------+------+-----+---------+-------+
    42 rows in set (0.00 sec)

    mysql> select host,user from user;
    +------------+------+
    | host | user |
    +------------+------+
    | % | root |
    | 127.0.0.1 | root |
    | ::1 | root |
    | localhost | |
    | localhost | root |
    | xiaofeibao | |
    | xiaofeibao | root |
    +------------+------+
    7 rows in set (0.02 sec)

    mysql> delect from user where host!='%';
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delect from user where host!='%'' at line 1
    mysql> delete from user where host!='%';
    Query OK, 6 rows affected (0.03 sec)

    mysql> delect from user where host!='%';
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delect from user where host!='%'' at line 1
    mysql> select host,user from user;
    +------+------+
    | host | user |
    +------+------+
    | % | root |
    +------+------+
    1 row in set (0.00 sec)

    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.04 sec)

    mysql>
    Broadcast message from root@xiaofeibao
    (unknown) at 11:34 ...

    The system is going down for reboot NOW!

  • 相关阅读:
    Linux 进程间通信(一)(经典IPC:消息队列、信号量、共享存储)
    Linux 进程间通信(一)(经典IPC:管道、FIFO)
    Linux I/O 进阶
    Linux 信号
    Linux 进程(二):进程关系及其守护进程
    转载:什么是B+树?
    转载:什么是B树?
    Redis批量删除脚本
    Java时间工具类
    JSP2.2自定义标签、EL函数
  • 原文地址:https://www.cnblogs.com/choucat/p/7411797.html
Copyright © 2011-2022 走看看