mysql 安装 (转) 1.安装make编译器(默认系统自带) 下载地址:http://www.gnu.org/software/make/ ? [c-sharp] ?view plaincopy? tar?zxvf?make-3.82.tar.gz?? cd?make-3.82?? ./configure?? make?? make?install?? [c-sharp] ?view plaincopy? tar?zxvf?mak
mysql 安装 (转)1.安装make编译器(默认系统自带)
下载地址:http://www.gnu.org/software/make/
?
[c-sharp]?view plaincopy ?- tar?zxvf?make-3.82.tar.gz??
- cd?make-3.82??
- ./configure??
- make??
- make?install??
- tar?zxvf?make-3.82.tar.gz??
- cd?make-3.82??
- ./configure??
- make??
- make?install??
?
2.安装bison(最好在编译LAMP前安装好所有基类软件)
下载地址:http://www.gnu.org/software/bison/
?
[c-sharp]?view plaincopy ?- tar?zxvf?bison-2.5.tar.gz??
- cd?bison-2.5??
- ./configure??
- make??
- make?install??
- tar?zxvf?bison-2.5.tar.gz??
- cd?bison-2.5??
- ./configure??
- make??
- make?install??
?
3.安装gcc-c++
下载地址:http://www.gnu.org/software/gcc/
?
[c-sharp]?view plaincopy ?- tar?zxvf?gcc-c++-4.4.4.tar.gz??
- cd?gcc-c++-4.4.4??
- ./configure??
- make??
- make?install??
- tar?zxvf?gcc-c++-4.4.4.tar.gz??
- cd?gcc-c++-4.4.4??
- ./configure??
- make??
- make?install??
?
?
4.安装cmake(请下载最新版本安装)
下载地址:http://www.cmake.org/
?
[c-sharp]?view plaincopy ?- tar?zxvf?cmake-2.8.4.tar.gz??
- cd?cmake-2.8.4??
- ./configure??
- make??
- make?install??
- tar?zxvf?cmake-2.8.4.tar.gz??
- cd?cmake-2.8.4??
- ./configure??
- make??
- make?install??
?
5.安装ncurses
下载地址:http://www.gnu.org/software/ncurses/
?
[c-sharp]?view plaincopy ?- tar?zxvf?ncurses-5.8.tar.gz??
- cd?ncurses-5.8??
- ./configure??
- make??
- make?install??
- tar?zxvf?ncurses-5.8.tar.gz??
- cd?ncurses-5.8??
- ./configure??
- make??
- make?install??
?
?
开始安装MySQL,下载地址:http://dev.mysql.com/
这里我在这里下载的mysql-5.6.12.tar.gz
ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/
准备工作
?
[c-sharp]?view plaincopy ?- groupadd?mysql??
-
useradd mysql -g mysql -M -s /sbin/nologin??
#增加一个名为CentOS Mysql的用户。-g:指定新用户所属的用户组(group)
-M:不建立根目录
-s:定义其使用的shell,/sbin/nologin代表用户不能登录系统。
- groupadd?mysql??
- useradd?-r?-g?mysql?mysql??
?
解压并安装MySQL
?
[c-sharp]?view plaincopy ?- tar?zxvf?mysql-5.6.12.tar.gz??
-
cd?mysql-5.6.12? (以下是一行 这里为了方便大家理解和注释写成换行注释,实际编译中请在换行前 加 " \ "链接)cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ ? #安装路径
-DMYSQL_DATADIR=/usr/local/mysql/data?????? \ ?? #数据文件存放位置
-DSYSCONFDIR=/etc????????????? \ ? ? ? ? ? ? ? ? ? ? ? ? ? ?????? #my.cnf路径
-DWITH_MYISAM_STORAGE_ENGINE=1??? \ ????? #支持MyIASM引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ ??? #支持InnoDB引擎
-DWITH_MEMORY_STORAGE_ENGINE=1 \ ?????? #支持Memory引擎
-DWITH_READLINE=1??????????????????? \ ? ? ? ? ? ? ? ? ? ? ? ? #快捷键功能(我没用过)
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock????? \?? #连接数据库socket路径
-DMYSQL_TCP_PORT=3306????????????????? \ ? ? ? ? ? ??? #端口
-DENABLED_LOCAL_INFILE=1??????????? \ ? ? ? ? ? ? ?? #允许从本地导入数据
-DWITH_PARTITION_STORAGE_ENGINE=1? \ ? #安装支持数据库分区
-DEXTRA_CHARSETS=all????????????????? \ ? ? ? ? ? ? ? ? ? #安装所有的字符集
-DDEFAULT_CHARSET=utf8????????????? \ ? ? ? ? ? ? ?? ?? #默认字符
-DDEFAULT_COLLATION=utf8_general_ci
- make??
- make?install??
?
完成后,继续下面的操作
?
[c-sharp]?view plaincopy ?- cd?/usr/local/mysql??
- chown -R mysql:mysql . (为了安全安装完成后请修改权限给root用户)
- scripts/mysql_install_db?--user=mysql (先进行这一步再做如下权限的修改)
- chown?-R root:mysql?.? (将权限设置给root用户,并设置给mysql组, 取消其他用户的读写执行权限,仅留给mysql "rx"读执行权限,其他用户无任何权限)
- chown -R mysql:mysql ./data ? (给数据库存放目录设置成mysql用户mysql组,并赋予chmod -R ug+rwx? 读写执行权限,其他用户权限一律删除仅给mysql用户权限)
- cd?/usr/local/mysql??
- chown?-R?mysql?.??
- chgrp?-R?mysql?.??
- scripts/mysql_install_db?--user=mysql??
- chown?-R?root?.??
?
下面的命令是可选的,将mysql的配置文件拷贝到/etc
?
[c-sharp]?view plaincopy ?- cp?support-files/my-medium.cnf?/etc/my.cnf? (原始老版本是此操作,5.6.12版本的是如下文件地址)
- cp?support-files/my-default.cnf? /etc/my.cnf? (并给/etc/my.cnf +x权限 同时删除 其他用户的写权限,仅仅留给root 和工作组 rx权限,其他一律删除连rx权限都删除)
- cp?support-files/my-medium.cnf?/etc/my.cnf??
?
?
#修改my.cnf配置
??? vim /etc/my.cnf
?? ???
??? #[mysqld] 添加:
??? datadir=/data/mysql
??? default-storage-engine=MyISAM
?
启动mysql:
?
[c-sharp]?view plaincopy ?- bin/mysqld_safe?--user=mysql?&??
- #启动mysql,看是否成功??
- netstat?-tnl|grep?3306??
- bin/mysqld_safe?--user=mysql?&??
- #启动mysql,看是否成功??
- netstat?-tnl|grep?3306??
?
上面是一种启动mysql的方法,还有一种简单的方便,如下:
?
[c-sharp]?view plaincopy ?- #将mysql的启动服务添加到系统服务中??
- cp?support-files/mysql.server?/etc/init.d/mysql??
- #现在可以使用下面的命令启动mysql??
- service?mysql start??
- #停止mysql服务??
- service?mysql stop??
- #重启mysql服务??
- service?mysql restart??
- #将mysql的启动服务添加到系统服务中??
- cp?support-files/mysql.server?/etc/init.d/mysql.server??
- #现在可以使用下面的命令启动mysql??
- service?mysql.server?start??
- #停止mysql服务??
- service?mysql.server?stop??
- #重启mysql服务??
- service?mysql.server?restart??
?
将mysql服务添加到开机启动项,让mysql服务开机启动
[c-sharp]?view plaincopy ?- chkconfig?--add?mysql
修改默认root账户密码,默认密码为空
修改密码 cd 切换到mysql所在目录?
cd /usr/local/mysql?
#./bin/mysqladmin -u root password?
回车在接下来的提示中设置新密码即可。。
?
? #启动MySQL
?? ?/usr/local/mysql/bin/mysqld_safe –defaults-file=/etc/my.cnf &
?? ?#或者
?? ?/etc/init.d/mysql start (service mysql start)
?? ? ?
?? ?#测试MySQL是否启动
?? ?# 1)查看是否有进程mysql
?? ?ps -ef | grep mysql
?? ?# 2)查看端口是否运行
?? ?netstat -tnl | grep 3306
?? ?# 3)读取mysql版本信息
?? ?mysqladmin version
?
转自:http://blog.csdn.net/zqtsx/article/details/9378703

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

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori


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

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

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

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.

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