Server installation MySQL tutorial and precautions

Source: Internet
Author: User
Tags integer numeric join log mysql in mysql tutorial natural log mysql database
Server | Tutorial |mysql

Considerations for installing and using MySQL on the server

First, how to get the latest version of MySQL?

To install MySQL, first of course to get its latest version, although we all know in FreeBSD packages can find MySQL, but I suggest you go to the network to find the latest version of MySQL.

Second, the installation of MySQL when the precautions?

1, if you are using Mysql+apache, the use of the FreeBSD network operating system, installation time you should be aware of the FreeBSD version of the problem, in the FreeBSD of the following version, MySQL Source contains mit-pthread running is normal, but in this version you have to use

Native threads, which is the option to add a with-named-thread-libs=-lc_r.

2, if you have a problem in the compile process, please check your GCC version is in the 2.81 version above, gmake version is more than 3.75.

3, if not a version of the problem, it may be your memory is not enough, please use the./configure-With-low-memory to join.

4, if you want to redo your configure, then you can type RM config.cache and make clean to clear the record.

5, we generally install MySQL in the/usr/local directory, this is the default value, you can also according to your needs to set the directory you installed.

Third, start and stop MySQL

If MySQL is never installed on your machine, the last command you type is/usr/local/mysql-3.23x/scripts/mysql_install_db when you install MySQL.

If you are installing more than one machine at the same time, you can edit the file, so that you can easily set up each of the permissions.

1, in the installation directory/usr/local boot MySQL can use/usr/local/share/mysql/mysql.server start remember to set the Mysql.server properties to 777

2, to stop the MySQL daemon can use/usr/local/bin/mysqladmin shutdown to achieve

3, if your MySQL has set the password, you must use mysqladmin-u root-p shutdown to achieve

Use root to build a MySQL user

You need to first log in to the machine, then change the directory access permissions Chown-r Mysql/usr/local/var, and then modify the Mysql.server file, which is located under/usr/local/share/mysql/, the Mysql_ Daemon_user=root changed into Mysql_daemon_user=mysql.

But after adding the database later, remember to change access to your related files: chown-r Mysql/usr/local/var/some_new_dbs

If you want your computer to automatically load MySQL when it starts, you just join a line in/etc/rc.local/usr/local/mysql/share.server start

Five, test your MySQL

After you start MySQL, you can use Ps-aux to test, you will find more than two process MySQL using the syntax overview

String Type---STRINGS

String matching must be a pair, for example:

' My is OCP '

"My is Ocpiscai"

They must be "or" "to express!"

Let's take some examples of single and double quotes in a string, such as:

Repeat double quotes:

Mysql>select "hi!" "OCP" "!"

->hi! " OCP "!

Because our HTML network contains many single quotes and double quotes, the program

There are some problems with single quotes and double quotes, so be careful.

Number Type---NUMBERS

Let's look at some legitimate digital expressions:

7

777

-777

77.77

77.777

-777.7777o+7

Database naming issues, tatble, INDEX, COLUMN, and alias name principle numbers can be used as the first word, can have a bottom line, but not exactly a number. As much as possible to avoid the use of $ characters, in MySQL $ character is completely legal, but it will be confused with PHP, so try not to use the good. There is no "." In the name. Character. The ALIAS name can use 256 characters, and the other lengths are generally limited to 60 characters characters. You can modify your mysql_install_db according to your needs change the length of the changes you need to change, change the time to pay attention to do not change too exaggerated, MySQL database can be supported, but the core of MySQL I have not tried, may appear wrong.

numeric function: When a numeric function fails, all returns are null

LOG10 (X): Log value with 10 base

Mysql>select LOG (EXP (1));

->2.000000

EXP (x): Returns the X-second side of E, where E is the base of the natural LOG.

FLOOR (x): Returns the largest integer less than or equal to X.

CEILING (x): Returns the smallest integer of heavy rain equal to X.

ROUND (X): rounded to an integer.

MOD (n,m) or%: Takes N divided by M's remainder.

SIGN (x): x greater than return 1,x equals 0 return 0,x less than 0 return-1.

ABS (X): Take absolute value.

ROUND (x,d): Rounded to D decimal. D equals 0 and is the same as round (X).

Trigonometric function:

Atan (x,y): Inverse trigonometric Functions

ATAN2 (x,y): Inverse trigonometric Functions

Least (X,y, ...) ): At least two parameters, returns the minimum value.

Greatest (X,y, ...) ): At least two parameters, returns the maximum value.

DEGREES (X): Converts radians (radian) to degrees.

RADIANS (X): Converts degrees to radians.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.