search
HomeDatabaseMysql TutorialLinux操作系统下MySQL的卸载、安装全过程

Linux下卸载MySQL1、查找以前是否装有MySQL命令:rpm -qa|grep -i MySQL可以看到MySQL的两个包:MySQL-4.1.12-3.RHEL4.1

Linux下卸载MySQL

1、查找以前是否装有MySQL

命令:rpm -qa|grep -i MySQL

可以看到MySQL的两个包:

MySQL-4.1.12-3.RHEL4.1

MySQLclient10-3.23.58-4.RHEL4.1

2、删除MySQL

删除命令:rpm -e --nodeps 包名

( rpm -ev MySQL-4.1.12-3.RHEL4.1 )

3、删除老版本MySQL的开发头文件和库

命令:rm -fr /usr/lib/MySQL

rm -fr /usr/include/MySQL

注意:卸载后/var/lib/MySQL中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除

rm -f /etc/my.cnf

  rm -fr /var/lib/MySQL


安装MySQL

安装前准备:两个rpm包

MySQL-client-5.1.20-0.glibc23.i386.rpm

MySQL-server-5.1.20-0.glibc23.i386.rpm

1、安装服务端:

命令:rpm -ivh MySQL-server-5.1.20-0.glibc23.i386.rpm

安装成功会出现....

warning: MySQL-server-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

Preparing... ########################################### [100%]

1:MySQL-server ########################################### [100%]

080220 13:58:27 [Note] Plugin 'InnoDB' disabled by command line option

080220 13:58:28 [Note] Plugin 'InnoDB' disabled by command line option

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/bin/MySQLadmin -u root password 'new-password'

/usr/bin/MySQLadmin -u root -h localhost.localdomain password 'new-password'

See the manual for more instructions.

Please report any problems with the /usr/bin/MySQLbug script!

The latest information about MySQL is available on the web at

Support MySQL by buying support/licenses at

Starting MySQL.[ OK ]

2、安装客户端

命令:rpm -ivh MySQL-client-5.1.20-0.glibc23.i386.rpm

成功表现:

[root@localhost ~]# rpm -ivh MySQL-client-5.1.20-0.glibc23.i386.rpm

warning: MySQL-client-5.1.20-0.glibc23.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

Preparing... ########################################### [100%]

1:MySQL-client ########################################### [100%]

3、登陆MySQL

登陆MySQL的命令是MySQL,MySQL 的使用语法如下:

MySQL [-u username] [-h host] [-p[password]] [dbname]

username 与 password 分别是 MySQL 的用户名与密码,MySQL的初始管理帐号是root,,没有密码,注意:这个root用户不是Linux的系统用户。MySQL默认用户是root,由于初始没有密码,第一次进时只需键入MySQL即可

[root@localhost ~]# MySQL

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.1.20-beta MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

MySQL>

出现了“MySQL>”提示符,恭喜你,安装成功!

   增加了密码后的登录格式如下:

   MySQL -u root -p

   Enter password: (输入密码)

   其中-u后跟的是用户名,-p要求输入密码,回车后在输入密码处输入密码。

   注意:这个MySQL文件在/usr/bin目录下,与后面讲的启动文件/etc/init.d/MySQL不是一个文件。

补:

通过rpm包安装、配置及卸载MySQL的详细过程.

  以MySQL-server-4.0.14-0.i386.rpm为例,放在/data目录下

  cd /data

  rpm -ivh MySQL-server-4.0.14-0.i386.rpm

  安装完成后在/usr/share/MySQL目录中会有一个MySQL的启动脚本MySQL.server及示例配置文件等(如my-huge.cnf、my-large.cnf、my-medium.cnf)

  拷贝一个示例配置文件作为MySQL的配置文件:

  cp /usr/share/MySQL/my-medium.cnf /etc/my.cnf

  rpm包安装完后自动将MySQL安装成系统服务,所以可以使用下面命令启动、停止MySQL

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor