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. Java 函数的参数说

    java函数参数传递的到底是值还是引用对确实容易让人迷糊.而很多时候因为对这个问题的模糊甚至造成一些错误.最常见的说法是基本类型传的是值,对象传的引用.对于基本类型,大家都达成共识,没有什么可以争论的 ...

  2. ASP.net 环境搭建

    https://www.cnblogs.com/leizhanjun/p/6081928.html

  3. Log4j.properties 属性详解以及 LOG4J日志级别详解

    转自:https://blog.csdn.net/lovely0903jpp/article/details/82261607 假如项目的生产环境上增加请求以及响应信息的打印,这个时候,对于新手来说, ...

  4. python缩进报错

    1.这个错误应该已经好久了:也应该熟悉了才对 IndentationError: unexpected indent python 缩进错误:意外缩进Python 但今天的问题有点特殊,我想在程序中间 ...

  5. 理解String的compareTo()方法返回值

    compareTo()的返回值是整型,它是先比较对应字符的大小(ASCII码顺序), 如果第一个字符和参数的第一个字符不等,结束比较,返回他们之间的差值. 如果第一个字符和参数的第一个字符相等,则以第 ...

  6. 并发知识与concurrent包

    要想进入一线互联网公司,这部分内容必须要会,否则的话,你始终都只能停留在比较low的段位. 关于并发知识,最重要的两个概念一定要搞清楚,那就是可见性和原子性.其中可见性与前面提到的volatile关键 ...

  7. qemu 参数简介

    参数 示例 说明 -hda -hda /data/windows.img 指定windows.img作为硬盘镜像 -cdrom -cdrom /data/windows.iso 指定windows.i ...

  8. NVL与NVL2

      一.NVL函数是一个空值转换函数   NVL(表达式1,表达式2)   如果表达式1为空值,NVL返回值为表达式2的值,否则返回表达式1的值. 该函数的目的是把一个空值(null)转换成一个实际的 ...

  9. MHA 一主两从搭建-keepalived-手动切换

    环境介绍:主机名 IP MHA角色 MySQL角色node1 192.168.56.26 Node MySQL Master node2 192.168.56.27 Node MySQL Master ...

  10. angular2的编译模式之AOT和JIT

    原文 https://www.jianshu.com/p/c959d90e91ce 大纲 1.angular应用为什么需要编译 2.angular的编译模式类型 3.JIT(Just-In-Time) ...