Mysql卸载

yum remove mysql mysql-server mysql-libs compat-mysql51

rm -rf /var/lib/mysql

rm /etc/my.cnf

查看是否还有mysql软件:

rpm -qa|grep mysql

有的话继续删除





Mysql安装

1>若本地没有安装包 能够考虑使用yum命令进行下载

# yum -y install mysql-server

# yum -y install php-mysql

2>安装后,MySQL自己主动启动,默认没实username和password,设置新password

#   /usr/bin/mysqladmin -u root password 'aaaaaa'

[root@luozhonghua ~]#   /usr/bin/mysqladmin -u root password 'aaaaaa'

/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

解决:

2.1》/etc/rc.d/init.d/mysqld status 看看mysql是否已经启动

3.2》service mysqld start

3>登录MySQL

>mysql -u root -p

enter password:’aaaaaa’





4>赋权连接的主机

#grant select,insert,update,delete on *.* to root@192.168.1.101  identified by 'aaaaaa'

grant select,insert,update,delete on *.* to root@127.0.0.1  identified by 'aaaaaa';









5>更改默认字符集

# cp my-medium.cnf  /etc/my.cnf

在[client]下增加 default-character-set=utf8

在[mysqld]下增加 default-character-set=utf8

查找安装路径

Rpm -qa | grep mysql

Rpm -ql 包名

[root@luozhonghua charsets]# find /usr -name my-medium.cnf

/usr/share/doc/mysql-server-5.1.73/my-medium.cnf

/usr/share/mysql/my-medium.cnf





#6>设置mysql开机自启动

# vi /etc/rc.local

增加例如以下一行

#/usr/share/mysql/mysql.server start

7>又一次启动MySQL

# /etc/init.d/mysql restart

service mysqld restart





8>測试;





[root@luozhonghua ~]# 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.1.73 Source distribution





Copyright (c) 2000, 2013, 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> create database xxx

    -> ;

Query OK, 1 row affected (0.06 sec)





mysql> ls

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'ls' at line 1

mysql> show databases

    -> ;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

| xxx                |

+--------------------+

4 rows in set (0.06 sec)





mysql> use xxx;

Database changed

mysql> show database

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'database' at line 1

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

| xxx                |

+--------------------+

4 rows in set (0.01 sec)





mysql> use xxx;

Database changed

mysql> create table test(

    -> int id not null,

    -> varchar(20) name null);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'int id not null,

varchar(20) name null)' at line 2

mysql> show tables;

Empty set (0.00 sec)





mysql> create table dbtest (

    -> id int ,

    -> name varchar);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        ')' at line 3

mysql> create table dbtest (

    -> id int,

    -> name varchar(10));

Query OK, 0 rows affected (0.07 sec)





mysql> show tables;

+---------------+

| Tables_in_xxx |

+---------------+

| dbtest        |

+---------------+

1 row in set (0.01 sec)





mysql> drop table xxx;

ERROR 1051 (42S02): Unknown table 'xxx'

mysql> drop table dbtest;

Query OK, 0 rows affected (0.00 sec)





mysql> ls

    -> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th                                                                                at corresponds to your MySQL server version for the right syntax to use near                        
                                                        'ls' at line 1

mysql> show tables;

Empty set (0.00 sec)





mysql>

linux mysql 卸载,安装,測试全过程的更多相关文章

  1. linux mysql 卸载与安装及配置命令

    1.RPM包安装方式的MySQL卸载 1) 检查是否安装了MySQL组件. # rpm -qa | grep -i mysql 2)卸载前关闭MySQL服务 # service mysql statu ...

  2. linux mysql查看安装信息

    ps -ef|grep mysql root               ?        :: /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mys ...

  3. linux mysql默认安装在哪个目录

    MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为 Linux本身的目录结构就比 ...

  4. MySQL卸载安装8.0.*

    一.卸载 1. 本人安装目录在C盘Program Files文件中(删除MySQL文件夹) 2. 找到C盘Program Data隐藏文件夹中的MySQL并删除(删除提示MySQL在运行的话可以去任务 ...

  5. redis-3.0.3安装測试

    $ tar xzvf redis-3.0.3.tar.gz $ cd redis-3.0.3 $ make     //编译 编译完毕进行 $ make test 命令測试 得到例如以下错误信息: c ...

  6. Linux下卸载安装mysql

    1.卸载命令:# rpm -qa |grep -i mysql # yum remove mysql-community mysql-community-server mysql-community- ...

  7. linux - mysql - 卸载:使用rpm方式安装的mysql

    一.查看系统中是否以rpm包安装的mysql rpm -qa | grep -i mysql 结果: 备注:如果有内容则证明是使用rpm方式安装的mysql 二.卸载 使用rpm -e 命令将上个命令 ...

  8. linux - mysql - 卸载:RPM包安装方式的MySQL卸载

    (1)检查是否安装了MySQL组件 [root@DB-Server init.d]# rpm -qa | grep -i mysql MySQL-devel-5.6.23-1.linux_glibc2 ...

  9. linux mysql数据库安装(tar.gz)

    概述 mysql数据库在linux下可以充分发挥威力,mysql数据库越来越受到软件公司的青睐,为什么呢? 免费.跨平台.轻.支持多并发 在北京很多软件公司属于创业型的中.小公司,从节约成本的角度考虑 ...

随机推荐

  1. arcgis webapp builder 安装试用

    ArcGIS WebApp Builder 是针对开发者的,用于高速构建基于HTML5/Javascript 技术的美观的 Web应用的一个工具. 用过Flex版本号的AppBuilder应该非常清楚 ...

  2. php线性表数组实现的删除操作

    php线性表数组实现的删除操作 一.总结 1.array_pop(): 函数删除数组中的最后一个元素. 二.代码 代码一: //线性表的删除(数组实现) function delete_array_e ...

  3. 解决Keystore was tampered with, or password was incorrect

    使用签名文件keystore查看生成的数字签名中报错解决 Keystore was tampered with, or password was incorrect 这是由于android规定自己定义 ...

  4. cocos2d-x 3.x游戏开发学习笔记(1)--mac下配置cocos2d-x 3.x开发环境

    打开用户文件夹下.bash_profile文件,配置环境 vim ~/.bash_profile //按键i,进行插入编辑(假设输错d进行删除一行) 环境配置过程例如以下: 1.首先配置下androi ...

  5. 图解String类型的不可变性及其原因

    1.String的不可变性 String s="abcd": 上面的语句定义了一个字符串变量s.该变量指向字符串"abcd",当初始化变量s时,会在堆中为s非配 ...

  6. 使用wepy开发微信小程序商城第二篇:路由配置和页面结构

    使用wepy开发微信小程序商城 第二篇:路由配置和页面结构 前言: 最近公司在做一个微信小程序的项目,用的是类似于vue的wepy框架.我也借此机会学习和实践一下. 小程序官方文档:https://d ...

  7. jquery-validate使用.md

    html <form id="s_form" class="form-horizontal" action="http://www.baidu. ...

  8. 如何启用“锁定内存页”选项 (Windows)

    默认情况下,禁用 Windows 策略"锁定内存页"选项.必须启用此权限才能配置地址窗口化扩展插件 (AWE).此策略将确定哪些帐户可以使用进程将数据保留在物理内存中,从而阻止系统 ...

  9. 10.3、android输入系统_必备Linux编程知识_任意进程双向通信(scoketpair+binder)

    3. 任意进程间通信(socketpair_binder) 进程每执行一次open打开文件,都会在内核中有一个file结构体表示它: 对每一个进程在内核中都会有一个task_struct表示进程,这个 ...

  10. JVM学习:方法重载的优先级

    重载:方法名一致,参数长度或者类型不一致. 先放总结,下面为例子 参数具有继承.实现关系,优先考虑子类: 在不考虑对基本类型自动装拆箱(auto-boxing,auto-unboxing),以及可变长 ...