zoukankan      html  css  js  c++  java
  • CentOS6.5安装MySQL及完全卸载

    原文地址:http://www.cnblogs.com/zhongshengzhen/
    第1步、yum安装mysql
    [root@localhost ~]# yum -y install mysql-server
     
    第2步、设置开机启动
    [root@localhost ~]# chkconfig mysqld on
     
    第3步、启动MySql服务
    [root@localhost ~]# service mysqld start
     
    第4步、设置MySQL的root用户设置密码
    [root@localhost ~]# mysql -u root
    mysql> set password for root@localhost=password('root');
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | test               |
    +--------------------+
    mysql> exit
     
    第5步、用新密码登陆
    [root@stonex ~]#  mysql -u root -p
    [root@localhost ~]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or g.
     
    第6步、基本命令
    show databases; //查看系统已存在的数据库
    use databasesname;   //选择需要使用的数据库
    drop database databasename; //删除选定的数据库
    exit    //退出数据库的连接
    create database test01;    //建立名为test的数据库
    show tables;        // 列出当前数据库下的表
    其他基本的增删改查使用标准SQL即可

    第7步、开放远程登录权限

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
     
     
    FQA:mysql工具连接不上mysql数据库

    Error1: 2003:Can't connect to MySQL server on 'localhost' 

    解决方法:关闭Linux的防火墙功能。 

    1. #chkconfig iptables off  
    2. #reboot  


    Error2: 1130 - Host'ClientIP' is not allowed to connect to this MySQL server 

    解决方法:使用root用户登陆Linux,更改容许登陆的IP地址范围。 

    1. mysql>grant all privileges on *.* to 'root'@'%' identified by 'rootpasswd' with grant option;  
     

    这段指令容许所有用root用户输入密码登陆该mysql server,如果将'%' 换乘'192.168.1.124' ,那么只有'192.168.1.124'的主机可以登陆。 

    现在重新用Navicat连接Linux mysql 便可以成功了。
     
     
    卸载MYSQL
    1、yum remove mysql mysql-server mysql-libs compat-mysql51
     
    2、rm -rf /var/lib/mysql

    3、rm /etc/my.cnf

    查看是否还有mysql软件:
    rpm -qa|grep mysql

    如果存在的话,继续删除即可。

  • 相关阅读:
    自定义dialog
    利用jquery实现自动登录
    文件的上传
    一些想法
    利用ajax实现分页效果
    自动化构建工具gulp的基础了解
    javascript模块化---requirejs
    交互ajax
    聊聊javascript的事件
    谈谈bootstrap在实践中的应用
  • 原文地址:https://www.cnblogs.com/zhongshengzhen/p/4919437.html
Copyright © 2011-2022 走看看