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. OpenShift 自定义 OPENSHIFT_DOCUMENT_ROOT 变量,替换网站根目录路径!

    OpenShift 自定义 OPENSHIFT_DOCUMENT_ROOT 变量,替换网站根目录路径! 预先定义的子目录 :)     DIY: DocumentRoot=${OPENSHIFT_RE ...

  2. Relaxation step(Dijkstra's 最短路径算法)

    翻译成中文就是"松弛",属于工程优化的范畴: Dijkstra 的单源最短路径算法,有一个重要的步奏,当访问到新的结点 u (加入到集合 S),然后遍历 u 的邻接顶点(Adj), ...

  3. FreeMarker template error: The following has evaluated to null or missing

    使用freemarker前端分页,报错: FreeMarker template error: The following has evaluated to null or missing 后端直接赋 ...

  4. .net core 修改网站启动端口

    原文:.net core 修改网站启动端口 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/yenange/article/details/81675 ...

  5. Hibernate3.5.4---java application的xml和annotation环境搭建(hibernate.cfg.xml配置文件说明,映射文件Student.hbm.xml说明

    http://blog.csdn.net/centre10/article/details/6050466 来自于:http://blog.csdn.net/centre10/article/deta ...

  6. 洛谷 P1601 A+B Problem(高精)

    P1601 A+B Problem(高精) 题目背景 无 题目描述 高精度加法,x相当于a+b problem,[b][color=red]不用考虑负数[/color][/b] 输入输出格式 输入格式 ...

  7. ZOJ 1242 Carbon Dating

    UVA昨天上不去,今天一大早起来还是上不去 0.0 于是去ZOJ 这题大意就是半衰期... 取对数用到了换底公式...我都忘了这玩意了T T 上代码... #include<iostream&g ...

  8. GPUImage ==> 一个基于GPU图像和视频处理的开源iOS框架

    Logo 项目介绍: GPUImage是Brad Larson在github托管的开源项目. GPUImage是一个基于GPU图像和视频处理的开源iOS框架,提供各种各样的图像处理滤镜,并且支持照相机 ...

  9. [Angular] Angular Global Keyboard Handling With EventManager

    If we want to add global event handler, we can use 'EventManager' from '@angular/platform-broswer'. ...

  10. 关于fatfs生成的wav文件是空,大小是0的问题

    绝大多数是因为打开错误 调试的时候,编写程序的时候 要记得res=f_open() 要有返回值res的设置