search
HomeDatabaseMysql TutorialRedHat AS6安装MySQL

RedHat 版本: 6.2 mysql 版本: mysql-5.5.19 安装包文件名: mysql-5.5.19-linux2.6-x86_64.tar.gz 一、安装步骤: 在官网上

RedHat 版本:  6.2

mysql 版本:   mysql-5.5.19

安装包文件名: mysql-5.5.19-linux2.6-x86_64.tar.gz

一、安装步骤:

在官网上下载mysql-5.5.19-linux2.6-i686.tar.gz压缩包,此包解压后为编译好的文件,不需要咱们自己编译、安装,直接修改配置即可用。

1、将 mysql-5.5.19-linux2.6-x86_64.tar.gz 拷贝至 /opt 目录

2、解压

# tar -zxvf mysql-5.5.19-linux2.6-i686.tar.gz -C /usr/local/ ;

注意:解压到/usr/local/ 非常重要

3. 将 mysql-5.5.19-linux2.6-x86_64 文件夹改名为 mysql

注意:现在mysql的目录为:/usr/local/mysql(如果放在其他目录,安装问题会很多)

4、建立数据库的用户组和用户

# groupadd mysql

# useradd -g mysql mysql

5、将mysql启动脚本mysql.server复制到/etc/rc.d/init.d目录中,命名为mysql;

# cp support-files/mysql.server /etc/rc.d/init.d/mysql

7、复制mysql配置文件my-medium.cnf到/etc/目录中,命名为my.cnf;

# cp support-files/my-medium.cnf /etc/my.cnf

8、修改mysql目录权限;

# chown -R root  /usr/local/mysql                //改变mysql目录的所属用户

# chgrp -R mysql /usr/local/mysql               //改变mysql目录的所属组

# chown -R mysql /usr/local/mysql/data      //改变data目录的所属用户,此目录用于存放数据库

9、生成mysql系统数据库。执行/usr/local/mysql/scripts/mysql_install_db安装授权表.

# /usr/local/mysql/scripts/mysql_install_db --user=mysql&

10、启动mysql服务.运行/usr/local/mysql/bin/mysqld_safe

# /usr/local/mysql/bin/mysqld_safe --user=mysql&

如果出现:Starting mysqld daemon with database from /usr/local/mysql/data代表正常启动mysql服务器。

11、启动mysql服务

# /etc/rc.d/init.d/mysql start

12、启动mysql

# /usr/local/mysql/bin/mysql

出现mysql>

到此,mysql就搞定了,,你可以操作数据库,可以修改管理员密码了……

启动mysql注意问题:

(1)要启动mysql必须先启动mysql_safe服务(上边第10步)。

# /usr/local/mysql/bin/mysqld_safe --user=mysql&

(2)其次启动mysql服务(上面第11步)

# /etc/rc.d/init.d/mysql start

(3)然后启动mysql

# /usr/local/mysql/bin/mysql

二、登录mysql方法:

(1)如果你已经在/usr/local/mysql/bin目录

执行:# ./mysql

如果 root用户设置了密码

执行:

./mysql -u root -p

输入mysql root的密码,然后回车。

(2)如果你在其他目录

执行:# /usr/local/mysql/bin/mysql

如果 root用户设置了密码

执行:

/usr/local/mysql/bin/mysql -u root -p

输入mysql root的密码,然后回车。

三、Linux 下 让mysql 自动启动

在MySQL安装程序的解压包/usr/local/mysql/support-files有一个叫myslq.server的启动脚本程序。把它复制到/etc/rc.d/init.d目录里面:

# cd /etc/rc.d/init.d

# cp /usr/local/mysql/support-files/mysql.server mysql

接着把它的属性改为“x”(executable,可执行)

# chmod +x mysql

最后,运行chkconfig把MySQL添加到你系统的启动服务组里面去。

执行chkconfig --add 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
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.