安装mysql 4.0.21遇到不少麻烦,也查了不少CU上面的文章,但都不是很管用,因为费了不少周折,所以有必要介绍一下经验,让后来人少走弯路。我写这篇文章的目的不仅是像我一样的初学者可以完成mysql-4.0.21的安装,而且能够凭本文的经验应付今后mysql版本的安装。是不是有点自夸?我觉得不是,因为我觉得步骤不是最重要的,后面的经验才是最重要的。另外,安装环境是Linux AS 3和gcc支持。
一、先说一下安装步骤
#groupadd mysql
#useradd -g mysql mysql
#tar zxvf mysql-4.0.21.tar.gz /*会生成一个mysql-4.0.21的目录*/
#cd mysql-4.0.21
#./configure --prefix=/usr/local/mysql
#make
#make install
#cp support-files/my-medium.cnf /etc/my.cnf /*这时会问是否覆盖重名文件,回答y*/
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql /*以mysql用户建系统库,必须以mysql用户,这点很重要!*/
#chown -R root .
#chown -R mysql var
#chgrp -R mysql .
#bin/mysqld_safe --user=mysql & /*也要用mysql用户运行,如果没任何反应,恭喜!成功了!*/
二、分享经验
1.虽然CU的精华文章很好,但mysql的版本不同,安装有细微差别!最可靠的是看解压缩后的mysql-VERSION目录里的INSTALL-SOURCE文件,我以上的安装步骤就是按照此文件一字不差的粘过去的,就成功了。开始时因为偷懒看CU的中文始终建系统库不能成功,因为那些文章都是以前版本的mysql安装。
2.细节情况
(1)本文是源代码安装,是为了减少不必要的麻烦。如果是二进制安装首先要选择正确的二进制包安装,具体细节请参照INSTALL-SOURCE文件,这点也很重要。步骤和以上差不多,只是少configure、make和make install三步骤。
(2)make大致需要15分钟的时间,请耐心等待,等啊等 :em24: :em24:
(3)make install要快的多,也就1分钟不到吧(没有秒表,估算不周请原谅)
(4)建系统库必须用mysql用户!上面已经强调了,我就是因为开始时没有加“--user=mysql”就建库建不成。建系统库会返回如下信息:
# bin/mysql_install_db --user=mysql
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
040913 20:11:39 /usr/local/mysql/libexec/mysqld: Shutdown Complete
(5)运行的时候也要用mysql用户,而且命令是mysqld_safe而不是以前的safe_mysqld。这点在INSTALL-SOURCE里面也有说明。这时候最怕出现“……ended”字样,这代表不能正常启动mysql。没有反应最好,按回车返回#提示符。
(6)正常的话,就可以用:
#vi /etc/rc.d/rc.local
命令编辑启动脚本,在最后加上“/usr/local/mysql/bin/mysqld_safe --user=mysql &”就完成了安装。
(7)如果还不放心,可以用“#netstat -nat”检查,如果有3306端口就对了;
也可以用“#ps -ef | grep mysqld”返回三行带有“mysqld”字样的结果也可以帮助判断。
(8)最后别忘记改mysql的密码

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

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

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

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

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'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

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

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


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

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

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools
