search
HomeDatabaseMysql TutorialLinux 安装 mysql5.5.19

在官网上下载mysql-5.5.19-linux2.6-i686.tar.gz压缩包,此包解压后为编译好的文件,不需要咱们自己编译、安装,直接修改配置即可用。 1、将 mysql-5.5.19-linux2.6-x86_64.tar.gz拷贝至 /opt 目录 2、解压 # tar -zxvfmysql-5.5.19-linux2.6-i686.tar.gz -C

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

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

2、解压

# tar -zxvfmysql-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、建立数据库的用户组和用户

# groupaddmysql

# useradd -gmysql mysql

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

# cpsupport-files/mysql.server /etc/rc.d/init.d/mysql

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

# cpsupport-files/my-medium.cnf /etc/my.cnf

8、修改mysql目录权限;

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

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

# chown -Rmysql/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 withdatabase 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

四、修改root用户密码:

/usr/local/mysql/bin/mysqladmin -u root password'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h test11 password'new-password'


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

EditPlus Chinese cracked version

EditPlus Chinese cracked version

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

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.