RHEL下安装MySQL
1.到mysql的网站(必须到官方网站下载,防止数据被修改,纂改过)下载四个必须rpm 安装包:http://dev.mysql.com/downloads/mysql/5.0
1.到mysql的网站(必须到官方网站下载,防止数据被修改,纂改过)下载四个必须rpm 安装包:
#linux-rhel5-ia64-rpms
MySQL-client-5.1.16-0.glibc23.i386.rpm
MySQL-devel-5.1.16-0.glibc23.i386.rpm
MySQL-server-5.1.16-0.glibc23.i386.rpm
MySQL-shared-5.1.16-0.glibc23.i386.rpm
2. 通过ssh远程控制工具传到服务器上,放在适当的目录下(如:/opt/mysql/mysql5.1.16)
3.进入目录(/opt/mysql/mysql5.1.16)下安装msyql:
rpm 文件是Red Hat公司开发的软件安装包,rpm可让Linux在安装软件包时免除许多复杂的手续。该命令在安装时常用的参数是 –ivh ,其中i表示将安装指定的rmp软件包,V表示安装时的详细信息,h表示在安装期间出现"#"符号来显示目前的安装过程。这个符号将持续到安装完成后才停止。
[root@qudee mysql5.1.16]# rpm –ivh MySQL-client-5.1.16-0.glibc23.i386.rpm
[root@qudee mysql5.1.16]# rpm –ivh MySQL-devel-5.1.16-0.glibc23.i386.rpm
[root@qudee mysql5.1.16]# rpm –ivh MySQL-shared-5.1.16-0.glibc23.i386.rpm
[root@qudee mysql5.1.16]# rpm –ivh MySQL-server-5.1.16-0.glibc23.i386.rpm
显示如下信息
warning: MySQL-server-5.1.16-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
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 password 'new-password'
See the manual for more instructions.
NOTE: If you are upgrading from a MySQL the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!
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 athttps://order.mysql.com
Starting MySQL...................................[失败]
4.查看已安装的包
[root@qudee mysql5.1.20]# rpm -qa | grep -i mysql
或者 [root@qudee mysql5.1.20]# rpm -qa | grep mysql
MySQL-devel-5.1.20-0.glibc23
MySQL-shared-5.1.20-0.glibc23
MySQL-client-5.1.20-0.glibc23
MySQL-server-5.1.20-0.glibc23
5.查看[root@qudee /]# locate mysql.server 的路径
/usr/share/man/man1/mysql.server.1.gz
/usr/share/mysql/mysql.server
复制并更名 [root@qudee /]#cp /usr/share/mysql/mysql.server /etc/init.d/mysqld
6.查看[root@qudee /]# locate my-huge.cnf 的路径
/usr/share/doc/MySQL-server-5.1.16/my-huge.cnf
/usr/share/mysql/my-huge.cnf
复制并更名[root@qudee /]#cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
7.启动服务:
service mysqld start
Starting MySQL [ OK ]
启动成功!恭喜~~~
8.编辑vi /etc/my.cnf 这个文件,设置字符集,支持国际化.
default-character-set=utf8 //在此添加字符集
# Here follows entries for some specific programs
# The MySQL server
[mysqld] port = 3306
#socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
default-character-set=utf8 //在此添加字符集
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 16
先按Esc, 再同时按Shift + ; 再输入wq! (推出并保存)
呵呵! 字符集就配置好了~~~
9.MySQL默认的数据文件存储目录为/var/lib/mysql。假如要把目录移到/qudeedata/dbdata/mysql5.1.16下需要进行下面几步:
(1)、/qudeedata/dbdata目录下建立mysql5.1.16目录
cd /qudeedata/dbdata
mkdir mysql5.1.16
(2)、把MySQL服务进程停掉:
service mysqld stop
(3)、把/var/lib/mysql整个目录移到/qudeedata/dbdata/mysql5.1.16
mv /var/lib/mysql /qudeedata/dbdata/mysql5.1.16
这样就把MySQL的数据文件移动到了/qudeedata/dbdata/mysql5.1.16 下
(4)、编辑MySQL的配置文件/etc/my.cnf
为保证MySQL能够正常工作,需要指明mysql.sock文件的产生位置。修改socket=/var/lib/mysql/mysql.sock一行中等号右边的值为:
/qudeedata/dbdata/mysql5.1.16/mysql/mysql.sock 。操作如下:
命令: vi my.cnf (用vi工具编辑my.cnf文件,找到下列数据修改之)
# The MySQL server
[mysqld]
port = 3306
#socket = /var/lib/mysql/mysql.sock(原内容,为了更稳妥用"#"注释此行)
socket = /qudeedata/dbdata/mysql5.1.16/mysql/mysql.sock (加上此行)
(5)、修改MySQL启动脚本/etc/rc.d/init.d/mysqld
最后,需要修改MySQL启动脚本/etc/rc.d/init.d/mysqld,把其中datadir=/var/lib/mysql一行中,,等号右边的路径改成你现在的实际存放路径:
/qudeedata/dbdata/mysql5.1.16。
[root@test1 etc]# vi /etc/rc.d/init.d/mysqld
#datadir=/var/lib/mysql (注释此行)
datadir=/qudeedata/dbdata/mysql5.1.16 (加上此行)
10、自动启动
1)察看mysql是否在自动启动列表中
[root@qudee /]# chkconfig –list
2)把MySQL添加到你系统的启动服务组里面去
[root@qudee /]# chkconfig – add mysql
11.测试通过命令是否能够启动,停止,重启
结果:
[root@qudee /]# service mysqld start
Starting MySQL [ OK ]
[root@qudee /]# service mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL [ OK ]
[root@qudee /]# service mysqld stop
Shutting down MySQL... [ OK ]
[root@qudee /]# /etc/init.d/mysqld start
Starting MySQL [ OK ]
[root@qudee /]# /etc/init.d/mysqld restart
Shutting down MySQL... [ OK ]
Starting MySQL [ OK ]
[root@qudee /]# /etc/init.d/mysqld stop
Shutting down MySQL.. [ OK ]
证明,成功安装mysql.注:还可以通过添加,查询,删除数据库中的数据进行操作.
12.完成安装!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

On Fedora39+, RHEL9, AlmaLinux9, RockyLinux9 and CentOSStream9Linux distributions, you can use the grubby program to manage GRUB boot entries. In this article, we will show you how to use GRUBY to add/remove kernel boot parameters from the GRUB boot entry on Fedora, RHEL, AlmaLinux, RockyLinux, and CentOSStream. We will also show you how to add/remove custom GR using GRUBY on Fedora, RHEL, AlmaLinux, RockyLinux and CentOSStream

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Analysis of the basic principles of the MySQL database management system MySQL is a commonly used relational database management system that uses structured query language (SQL) for data storage and management. This article will introduce the basic principles of the MySQL database management system, including database creation, data table design, data addition, deletion, modification, and other operations, and provide specific code examples. 1. Database Creation In MySQL, you first need to create a database instance to store data. The following code can create a file named "my
