search
HomeDatabaseMysql Tutorial在服务器上安装使用MySQL的注意事项

在服务器上安装使用MySQL的注意事项

Jun 07, 2016 pm 04:04 PM
mysqluseInstallHow about itnew versionserverPrecautions

一、怎么样取得最新版本的MySQL? 要安装 MySQL, 首先要当然要取得它的最新版本,虽然大家都知道在 FreeBSD 的 Packages 中可以找到 MySQL ,但是我还是建议大家到网络上去找最新版本的 MySQL 。介绍大家到 http://www.mysql.org 去下载,这里的最新版本是 M

一、怎么样取得最新版本的MySQL?
要安装MySQL,首先要当然要取得它的最新版本,虽然大家都知道在FreeBSDPackages中可以找到MySQL,但是我还是建议大家到网络上去找最新版本的MySQL。介绍大家到http://www.mysql.org去下载,这里的最新版本是MySQL 3.23 versions
二、安装MySQL时候的注意事项?
1
、如果您是用MySQL+Apache,使用的又是FreeBSD网路操作系统的话,安装时候你应按注意到FreeBSD的版本问题,在FreeBSD3.0以下版本来说,MySQL Source内含的MIT-pthread运行是正常的,但在这版本以上,你必须使用native threads,也就是加入一个with-named-thread-libs=-lc_r的选项。
2
、如果您在COMPILE过程中出了问题,请先检查你的gcc版本是否在2.81版本以上,gmake版本是否在3.75以上。
3
、如果不是版本的问题,那可能是你的内存不足,请使用./configure -- with-low-memory来加入。
4
、如果您要重新做你的configure,那么你可以键入rm config.cachemake clean来清除记录。
5
、我们一般把MySQL安装在/usr/local目录下,这是缺省值,您也可以按照你的需要设定你所安装的目录。
三、启动和停止MySQL
如果你的机器上从未安装过MySQL的话,在安装MySQL时,最后一个键入的命令是/usr/local/mysql-3.23X/scripts/mysql_install_db
如果你是同时安装多台机器的话,你可以编辑一下这档案,这样一来可以使你方便的设置好每一台的权限。
1
、在安装目录/usr/local启动mysql可以使用/usr/local/share/mysql/mysql.server start记得把mysql.server的属性设置成777
2
、要停止mysql daemon可以使用/usr/local/bin/mysqladmin shutdown来实现
3
、如果你的mysql已经设置了密码,你必须使用mysqladmin -u root -p shutdown来实现
四、用root建一个MYSQL的使用者
你需要先用root登入机器,然后改变目录存取权限chown -R mysql /usr/local/var,接着修改mysql.server 档案,这文件位于/usr/local/share/mysql/下,把mysql_daemon_user=root改成mysql_daemon_user=mysql
但是在以后新增资料库之后,记得把你的相关档案存取权限改过去:chown -R mysql /usr/local/var/some_new_dbs
如果你希望你的电脑启动时候自动加载mysql,你只要在/etc/rc.local加入一行/usr/local/mysql/share.server start

五、测试你的mysql
启动mysql后,你可以使用ps -aux来测试,你就发现多了两个process MYSQL使用的语法概观
字符串类型---STRINGS
字符串的匹配必须是成对的,例如:
‘MY IS OCP’
“MY IS OCPISCAI”

他们必须是是用‘’“”来表示!
我们来举一些在字符串里面含有单引号和双引号的例子,例如:重复双引号:
mysql>select “ hi! “ “ocp” “!”
->hi!”ocp”!

因为我们的HTML网络里含有许多的单引号和双引号,所以程序在这里会遇到些因为单引号和双引号而出错的问题,所以要加以小心。
数字类型---NUMBERS

我们来看一些合法的数字表达方式:
7
777
-777
77.77
77.777
-777.7777o+7

资料库的命名问题,TATBLEINDEXCOLUMN、以及ALIAS NAME 的命名原则数字可以做为字首,可以有底线,但是不能完全是数字。尽可能的避免使用$字符,在MYSQL$字符是完全合法的,不过就是会和PHP混淆,所以尽量不使用的好。在命名里不能有“.”字符。ALIAS NAME可以使用256个字符,其它的长度一般都限制在60个字符内。你可以根据你的需要自己修改MYSQL_INSTALL_DB把你所需要修改的长度改一改,改的时候注意别改的太过夸张,MYSQL资料库是可以支持,但MYSQL的核心我没有试过,也许会出现错误。
数值函数:在数值函数出错的时候,传回的都是NULL

LOG10X :以10为底的LOG
mysql>SELECT LOG
EXP1));
-
ɮ.000000
EXP
X):传回EX次方,其中ENATURAL LOG 的底数。
FLOOR
X):传回小于等于X的最大整数。
CEILING
X):传回大雨等于X的最小整数。
ROUND
X):四舍五入到整数。
MOD
NM 或者 % :取N除以M的余数。
SIGN
X):X大于传回1X等于0传回0X小于0传回-1
ABS
X):取绝对值。
ROUND
XD):四舍五入到D位小数。D等于0则与ROUNDX)相同。
三角函数:
ATAN
XY):反三角函数
ATAN2
XY):反三角函数
LEAST
XY,。。。):至少两个参数,传回最小值。
GREATEST
XY,。。。):至少两个参数,传回最大值。
DEGREES
X):转换弧度(RADIAN)到度数。
RADIANS
X):转换度数到弧度。


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 stored procedures in MySQL?What are stored procedures in MySQL?May 01, 2025 am 12:27 AM

Stored procedures are precompiled SQL statements in MySQL for improving performance and simplifying complex operations. 1. Improve performance: After the first compilation, subsequent calls do not need to be recompiled. 2. Improve security: Restrict data table access through permission control. 3. Simplify complex operations: combine multiple SQL statements to simplify application layer logic.

How does query caching work in MySQL?How does query caching work in MySQL?May 01, 2025 am 12:26 AM

The working principle of MySQL query cache is to store the results of SELECT query, and when the same query is executed again, the cached results are directly returned. 1) Query cache improves database reading performance and finds cached results through hash values. 2) Simple configuration, set query_cache_type and query_cache_size in MySQL configuration file. 3) Use the SQL_NO_CACHE keyword to disable the cache of specific queries. 4) In high-frequency update environments, query cache may cause performance bottlenecks and needs to be optimized for use through monitoring and adjustment of parameters.

What are the advantages of using MySQL over other relational databases?What are the advantages of using MySQL over other relational databases?May 01, 2025 am 12:18 AM

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.

How do you handle database upgrades in MySQL?How do you handle database upgrades in MySQL?Apr 30, 2025 am 12:28 AM

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

What are the different backup strategies you can use for MySQL?What are the different backup strategies you can use for MySQL?Apr 30, 2025 am 12:28 AM

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

What is MySQL clustering?What is MySQL clustering?Apr 30, 2025 am 12:28 AM

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

How do you optimize database schema design for performance in MySQL?How do you optimize database schema design for performance in MySQL?Apr 30, 2025 am 12:27 AM

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

How can you optimize MySQL performance?How can you optimize MySQL performance?Apr 30, 2025 am 12:26 AM

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi

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 Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

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.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft