linux mysql 卸载,安装,測试全过程
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 卸载,安装,測试全过程的更多相关文章
- linux mysql 卸载与安装及配置命令
1.RPM包安装方式的MySQL卸载 1) 检查是否安装了MySQL组件. # rpm -qa | grep -i mysql 2)卸载前关闭MySQL服务 # service mysql statu ...
- linux mysql查看安装信息
ps -ef|grep mysql root ? :: /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mys ...
- linux mysql默认安装在哪个目录
MySQL安装完成后不象SQL Server默认安装在一个目录,它的数据库文件.配置文件和命令文件分别在不同的目录,了解这些目录非常重要,尤其对于Linux的初学者,因为 Linux本身的目录结构就比 ...
- MySQL卸载安装8.0.*
一.卸载 1. 本人安装目录在C盘Program Files文件中(删除MySQL文件夹) 2. 找到C盘Program Data隐藏文件夹中的MySQL并删除(删除提示MySQL在运行的话可以去任务 ...
- redis-3.0.3安装測试
$ tar xzvf redis-3.0.3.tar.gz $ cd redis-3.0.3 $ make //编译 编译完毕进行 $ make test 命令測试 得到例如以下错误信息: c ...
- Linux下卸载安装mysql
1.卸载命令:# rpm -qa |grep -i mysql # yum remove mysql-community mysql-community-server mysql-community- ...
- linux - mysql - 卸载:使用rpm方式安装的mysql
一.查看系统中是否以rpm包安装的mysql rpm -qa | grep -i mysql 结果: 备注:如果有内容则证明是使用rpm方式安装的mysql 二.卸载 使用rpm -e 命令将上个命令 ...
- linux - mysql - 卸载:RPM包安装方式的MySQL卸载
(1)检查是否安装了MySQL组件 [root@DB-Server init.d]# rpm -qa | grep -i mysql MySQL-devel-5.6.23-1.linux_glibc2 ...
- linux mysql数据库安装(tar.gz)
概述 mysql数据库在linux下可以充分发挥威力,mysql数据库越来越受到软件公司的青睐,为什么呢? 免费.跨平台.轻.支持多并发 在北京很多软件公司属于创业型的中.小公司,从节约成本的角度考虑 ...
随机推荐
- [转载]Google Java Style 中文版
转自:http://www.blogjava.net/zh-weir/archive/2014/02/08/409608.html Google Java Style 中文版 基于官方文档20 ...
- Android 6.0 最简单的权限获取方法 RxPermition EasyPermition
Android 6.0 要单独的获取权限 这里提供两种很简单的方法 EasyPermition RxPermition EasyPermition https://github.com/googles ...
- wampserver安装后访问localhost出现 Forbidden问题
Forbidden You don't have permission to access / on this server. 修改php的配置文件httpd.conf. 在原有的位置文件中找到配置节 ...
- 【例题 7-10 UVA - 11212】Editing a Book
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 迭代加深搜. 很容易想到,最多只要搜8层就可以得到答案了 ->最多8下肯定可以还原. 则枚举一下最大层数.然后做个深搜就好. ...
- Valgrind的用法
Valgrind是执行在Linux上一套基于仿真技术的程序调试和分析工具,它包括一个内核──一个软件合成的CPU,和一系列的小工具,每一个工具都能够完毕一项任务──调试.分析,或測试等. Valgri ...
- Validation failed for query for method public abstract boxfish.bean.Student boxfish.service.StudentServiceBean.find(java.lang.String)!
转自:https://blog.csdn.net/lzx925060109/article/details/40323741 1. Exception in thread "main&quo ...
- 使用Samba在Linux服务器上搭建共享文件服务
最近我们的小团队需要在服务器上共分出一个共享文件夹用于大家存放公共的资源文档, 大家想啊,这肯定很简单呀,在Windows下面只要创建相关的windows account,共享某个文件夹,把读/写权限 ...
- Redis 哨兵(sentinel)模式集群配置(5.0.3版本)
一.准备工作 1.系统环境:centos6.4 2.服务器六台(1主5从): 192.168.1.161(master) 192.168.1.162(slave) 192.168.1.163(slav ...
- SoC总线专题
SoC总线专题 TileLink ARM系列总线 APB AHB AXI CHI Wishbone
- 搭建MHA问题汇总
1,Can't exec "mysqlbinlog": No such file or directory at /usr/share/perl5/vendor_perl/MHA/ ...