mysql果然是不愧是目前最火的数据库,自从mysql5.5.8之后,mysql的源码包编译安装都要用到cmake来进行编译了,编译的过程没有本质
mysql果然是不愧是目前最火的数据库,自从mysql5.5.8之后,mysql的源码包编译安装都要用到cmake来进行编译了,编译的过程没有本质的区别,但是要直观很多。以前安装过很多次mysql,每次都会有些小小错误。记录一下本次安装过程,以备日后参考。
1.源码包准备
(1)mysql-5.5.15.tar.gzmysqlmysql源码包。去下载最新的mysql5.5.15。注意千万不要下成了安装包,忙活半天都白搭。我就是如此,悲剧!
(2)cmake-2.8.4.tar.gz,cmake安装包.在可下最新版本。
(3)安装所需相关库文件
#yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
2.编译过程
(1)创建目录,用户和权限。
#mkdir -p /usr/local/mysql #建立mysql安装目录
#mkdir -p /data/mysql #建立mysql数据库目录
#groupadd mysql #添加mysql组
#useradd -g msyql msyql #添加一个mysql用户并加入到mysql组中
#chown -R mysql.mysql /data/mysql #将/data/mysql目录的所有权赋予mysql组中的mysql用户
(2)安装cmake
#tar cmake-2.8.4.tar.gz
#cd cmake-2.8.4
#./configure
#make && make install
(3)安装mysql
#cd mysql-5.5.15
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 '这一堆东西真的看懂的没几个,没办法初学者。
#make &&make install
#cp support-files/my-medium.cnf /etc/my.cnf #如果你的机器的内存教大,可以复制My-huge.cnf文件
#chmod 755 scripts/mysql_install_db
#scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/ ##初始化数据库
# cp support-files/mysql.server /etc/init.d/mysql #设置开机启动mysql
#chmod 755 /etc/init.d/mysql
#chkconfig mysql on #开机启动
#echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile #将mysql的安装路径加入PATH中,,方便启动mysql(重启生效)
#/etc/init.d/mysql start #启动mysql
可以在进程中查看mysql是否启动,完成。
设置一个mysql的root密码
#mysqlamdin -u root password '123456'
在这里我出现过一个问题:删除mysql 重新安装后会有一些错误。在编译完mysql后启动时会提示
Starting MySQL..The server quit without updating PID file (/data/mysql/localhost.localdomain.pid
此时需要编辑vi /etc/my.cnf中的[mysqld]模块,在其中加入你的datadir路径如
datadir = /data/mysql
如果路径中没有localhost.localdomain.pid文件可能需要touch一个,然后赋予mysql用户的权限。
最后ps -aux |grep mysql
kill 掉mysql的进程
#/etc/init.d/mysql start 即可

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

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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.

WebStorm Mac version
Useful JavaScript development tools
