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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
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)

Hot Topics

Java Tutorial
1667
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Apr 18, 2025 am 08:42 AM

When developing an e-commerce website using Thelia, I encountered a tricky problem: MySQL mode is not set properly, causing some features to not function properly. After some exploration, I found a module called TheliaMySQLModesChecker, which is able to automatically fix the MySQL pattern required by Thelia, completely solving my troubles.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

See all articles