linux 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自动启动,默认没有用户名和密码,设置新密码
# /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>
转载于:https://www.cnblogs.com/kool/p/6696030.html
linux mysql 卸载,安装,测试全过程相关推荐
- Linux MySQL下载安装
介绍 参考视频教程: https://www.bilibili.com/video/BV13a411q753?p=135 查询当前系统中安装的所有软件 rpm -qa 1. mysql的下载 1.1 ...
- linux mysql 卸载,安装,測试全过程
Mysql卸载 yum remove mysql mysql-server mysql-libs compat-mysql51 rm -rf /var/lib/mysql rm /etc/my.cnf ...
- Linux下Mysql卸载安装教程:卸载老版本,安装新版本
由于:练习Mysql的主从复制,保证Mysql的版本一致,所以更新Linux上的Mysql版本 第一步:卸载linux系统上的原来的版本的mysql: 1.使用命令行查询电脑上的版本: rpm -qa ...
- brew安装mysql 卸载_Ubuntu环境下MySQL卸载安装配置远程访问三步曲
卸载 查看所有依赖 dpkg --list|grep mysql 卸载 MySQL sudo apt-get remove mysql-* 清除残留数据,弹出界面选择 yes dpkg -l |gre ...
- Linux JDK 卸载安装
当前服务器已安装JDK,先进行JDK卸载 Linux JDK 卸载 1.查看当前JDK安装路径 whereis java which java (java执行路径) echo $JAVA_HOME(之 ...
- linux mysql 卸载命令行,mysql卸载命令_Linux下卸载系统自带的MySQL数据库
摘要 腾兴网为您分享:Linux下卸载系统自带的MySQL数据库,永安期货,央视影音,搜狗阅读,瑞易生活等软件知识,以及winulator,不做手机控app,豆瓣电影app,vr网球4,西方世界的劫难 ...
- [踩坑合集] 双linux系统卸载/安装,nvidia驱动安装,引导项缺失,开机黑屏,nvidia-smi和nvcc -v CUDA版本不匹配
"个人文化属性" 双系统 1. 双linux系统格式化一个linux系统 2. 安装新的20系统(双系统) 3. 重启后直接进入grub界面(修复它) 3.1 寻找你的系统分区 3 ...
- linux mysql编译安装mysql_【MySQL安装】Linux下安装MySQL(预编译)
预编译方式安装MySQL 一.环境说明 操作系统:Redhat Linux 7.2 MySQL版本:5.7 安装介质:mysql-5.7.25-linux-glibc2.12-x86_64.tar.g ...
- mysql卸载安装视频_MYSQL安装与卸载(一)
系统:win10(其他版本系统不在本次内容) MySQL安装主流分为两种:msi,zip Zip:压缩版,这需要配置init文件,然后通过win+R 进入cmd控制台进行操作(本次 以msi版本为主, ...
- linux mysql 最小安装,Linux最小化安装之安装mysql
mysql是我们开发过程中场景的关系型数据之一.所以一起看看在Linux中通过安装包是怎么安装的. 下载mysql 根据自己的Linux服务器版本下载对应的mysql,案例中我们使用的Centos7. ...
最新文章
- socket第三方库 AsyncSocket(源码注释解读.转)
- cisco路由器基本实验之三 动态路由之RIP协议的配置(Boson NetSim)
- Elasticsearch6 去重
- 下一代 Debian - \'Lenny\' 代码冻结
- oracle 实现map,PLSQL实现的map功能,以及一些疑惑
- shader weaver_具有自定义汇编程序,Weaver和运行时的可插拔知识
- 巧用记忆化搜索代替暴力递归(洛谷P1464题题解,Java语言描述)
- VSS (Visual Source Safe 2005) 用法详解(转载)
- 【智简联接,万物互联】华为云·云享专家董昕:Serverless和微服务下, IoT的变革蓄势待发
- 好程序员训练营-Java变量的作用域
- 【LeetCode】Remove Nth Node From End of List
- 检查字段是否包含字符串
- mysql5.5编译安装_mysql5.5编译安装及配置
- 关于python装饰器的总结
- Linux中文件的分类
- 基于小米球(Ngrok)实现内网穿透
- html5svg在线编辑器,HTML5 SVG图形在线编辑器
- 网络操作系统和分布式操作系统的区别
- mysql查询每个月入职人数_按年份统计入职人数sql语句
- Unity资源管理(一)
热门文章
- ICLR2019 | 模型训练会发生了大量的、反复的样本遗忘现象,如何解决?
- NLP和CV的双子星,注入Mask的预训练模型BERT和MAE
- 你掌握垃圾分类大法了吗?图像分类1分钟轻松解决
- 你知道吗?还有比自回归方式更快更好的序列生成!
- 深度学习2.0-23.Keras高层接口之CIFAR10自定义网络实战
- Python中的抽象
- 我终于知道,中国互联网是怎么弯道超车,干翻美国了
- 《linux核心应用命令速查》连载二:lastcomm:显示以前使用过的命令的信息
- 深入浅出Flume之原理解析
- 直方图均衡图像对比度(histogram equalization)PYTHON+OPENCV2