Home Database Mysql Tutorial mysql 装配 (转)

mysql 装配 (转)

Jun 07, 2016 pm 04:23 PM
make mysql Install translater default

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 ?
  1. tar?zxvf?make-3.82.tar.gz??
  2. cd?make-3.82??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?make-3.82.tar.gz??
  2. cd?make-3.82??
  3. ./configure??
  4. make??
  5. make?install??

?

2.安装bison(最好在编译LAMP前安装好所有基类软件)

下载地址:http://www.gnu.org/software/bison/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?bison-2.5.tar.gz??
  2. cd?bison-2.5??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?bison-2.5.tar.gz??
  2. cd?bison-2.5??
  3. ./configure??
  4. make??
  5. make?install??

?

3.安装gcc-c++

下载地址:http://www.gnu.org/software/gcc/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?gcc-c++-4.4.4.tar.gz??
  2. cd?gcc-c++-4.4.4??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?gcc-c++-4.4.4.tar.gz??
  2. cd?gcc-c++-4.4.4??
  3. ./configure??
  4. make??
  5. make?install??

?

?

4.安装cmake(请下载最新版本安装)

下载地址:http://www.cmake.org/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?cmake-2.8.4.tar.gz??
  2. cd?cmake-2.8.4??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?cmake-2.8.4.tar.gz??
  2. cd?cmake-2.8.4??
  3. ./configure??
  4. make??
  5. make?install??

?

5.安装ncurses

下载地址:http://www.gnu.org/software/ncurses/

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?ncurses-5.8.tar.gz??
  2. cd?ncurses-5.8??
  3. ./configure??
  4. make??
  5. make?install??
[c-sharp]?view plaincopy ?
  1. tar?zxvf?ncurses-5.8.tar.gz??
  2. cd?ncurses-5.8??
  3. ./configure??
  4. make??
  5. 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 ?
  1. groupadd?mysql??
  2. useradd mysql -g mysql -M -s /sbin/nologin??
    #增加一个名为CentOS Mysql的用户。

    -g:指定新用户所属的用户组(group)

    -M:不建立根目录

    -s:定义其使用的shell,/sbin/nologin代表用户不能登录系统

[c-sharp]?view plaincopy ?
  1. groupadd?mysql??
  2. useradd?-r?-g?mysql?mysql??

?

解压并安装MySQL

?

[c-sharp]?view plaincopy ?
  1. tar?zxvf?mysql-5.6.12.tar.gz??
  2. 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


  3. make??
  4. make?install??

?

完成后,继续下面的操作

?

[c-sharp]?view plaincopy ?
  1. cd?/usr/local/mysql??
  2. chown -R mysql:mysql . (为了安全安装完成后请修改权限给root用户)
  3. scripts/mysql_install_db?--user=mysql (先进行这一步再做如下权限的修改)
  4. chown?-R root:mysql?.? (将权限设置给root用户,并设置给mysql组, 取消其他用户的读写执行权限,仅留给mysql "rx"读执行权限,其他用户无任何权限)
  5. chown -R mysql:mysql ./data ? (给数据库存放目录设置成mysql用户mysql组,并赋予chmod -R ug+rwx? 读写执行权限,其他用户权限一律删除仅给mysql用户权限)
[c-sharp]?view plaincopy ?
  1. cd?/usr/local/mysql??
  2. chown?-R?mysql?.??
  3. chgrp?-R?mysql?.??
  4. scripts/mysql_install_db?--user=mysql??
  5. chown?-R?root?.??

?

下面的命令是可选的,将mysql的配置文件拷贝到/etc

?

[c-sharp]?view plaincopy ?
  1. cp?support-files/my-medium.cnf?/etc/my.cnf? (原始老版本是此操作,5.6.12版本的是如下文件地址)
  2. cp?support-files/my-default.cnf? /etc/my.cnf? (并给/etc/my.cnf +x权限 同时删除 其他用户的写权限,仅仅留给root 和工作组 rx权限,其他一律删除连rx权限都删除)
[c-sharp]?view plaincopy ?
  1. 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 ?
  1. bin/mysqld_safe?--user=mysql?&??
  2. #启动mysql,看是否成功??
  3. netstat?-tnl|grep?3306??
[c-sharp]?view plaincopy ?
  1. bin/mysqld_safe?--user=mysql?&??
  2. #启动mysql,看是否成功??
  3. netstat?-tnl|grep?3306??

?

上面是一种启动mysql的方法,还有一种简单的方便,如下:

?

[c-sharp]?view plaincopy ?
  1. #将mysql的启动服务添加到系统服务中??
  2. cp?support-files/mysql.server?/etc/init.d/mysql??
  3. #现在可以使用下面的命令启动mysql??
  4. service?mysql start??
  5. #停止mysql服务??
  6. service?mysql stop??
  7. #重启mysql服务??
  8. service?mysql restart??
[c-sharp]?view plaincopy ?
  1. #将mysql的启动服务添加到系统服务中??
  2. cp?support-files/mysql.server?/etc/init.d/mysql.server??
  3. #现在可以使用下面的命令启动mysql??
  4. service?mysql.server?start??
  5. #停止mysql服务??
  6. service?mysql.server?stop??
  7. #重启mysql服务??
  8. service?mysql.server?restart??

?

将mysql服务添加到开机启动项,让mysql服务开机启动

[c-sharp]?view plaincopy ?
  1. 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

Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values ​​to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

The difference between oracle database and mysql The difference between oracle database and mysql May 10, 2024 am 01:54 AM

Oracle database and MySQL are both databases based on the relational model, but Oracle is superior in terms of compatibility, scalability, data types and security; while MySQL focuses on speed and flexibility and is more suitable for small to medium-sized data sets. . ① Oracle provides a wide range of data types, ② provides advanced security features, ③ is suitable for enterprise-level applications; ① MySQL supports NoSQL data types, ② has fewer security measures, and ③ is suitable for small to medium-sized applications.

See all articles