亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

cmake編譯安裝mysql5.5

發布時間:2020-04-13 23:10:56 來源:網絡 閱讀:493 作者:1243983186 欄目:MySQL數據庫

                            CMAKE方式編譯安裝Mysql5.5

1、源碼cmake方式編譯安裝MySQL5.5.32

安裝前先安裝:

yum install ncurses-devel -y


1.1 下載Mysqlcmake安裝包:

wget http://wwwNaNake.org/files/v2.8/cmake-2.8.8.tar.gz


1.2 查看系統環境

cat /etc/redhat-release

uname -r

uname -m

1.3 安裝cmake

tar zxf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake

gmake install

cd ../

1.4 開始安裝mysql

1.4.1 創建用戶和組

groupadd mysql

useradd mysql -s /sbin/nologin -M -g mysql

yum install ncurses-devel -y


1.4.2 解壓編譯MySQL

tar zxf mysql-5.5.32.tar.gz

cd mysql-5.5.32


cmake -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \

-DMYSQL_DATADIR=/application/mysql-5.5.32/data\

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITHOUT_PARTITION_STORAGE_ENGINE=1


make


make install

ln -s /application/mysql-5.5.32/ /application/mysql

如果上述操作未出現錯誤,則MySQL軟件的安裝就算成功了。


1.4.3 初始化配置MySQL

1.查看默認模板配置文件

[root@Mysqlmysql-5.5.32]# ll support-files/my*.cnf

-rw-r--r--1 root root  4759 Apr 25 18:19support-files/my-huge.cnf

-rw-r--r--1 root root 19809 Apr 25 18:19 support-files/my-innodb-heavy-4G.cnf

-rw-r--r--1 root root  4733 Apr 25 18:19support-files/my-large.cnf

-rw-r--r--1 root root  4744 Apr 25 18:19support-files/my-medium.cnf

-rw-r--r--1 root root  2908 Apr 25 18:19support-files/my-small.cnf

2.選擇配置文件

/bin/cpsupport-files/my-small.cnf /etc/my.cnf

測試環境選小的,生產環境可以根據硬件選擇support-files/my-innodb-heavy-4G.cnf


3.配置環境變量

echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile

tail -1 /etc/profile

source /etc/profile

echo $PATH


4.初始化數據文件(容易出錯的步驟)

#建立mysql數據文件目錄

mkdir -p /application/mysql/data

#授權mysql用戶訪問mysql的安裝目錄

chown -R mysql.mysql /application/mysql/*

chmod -R 1777 /tmp

#初始化數據庫文件(如果重新初始化數據庫文件,必須先執行:rm -fr /application/mysql/data/*)

/application/mysql/scripts/mysql_install_db --basedir=/application/mysql--datadir=/application/mysql/data --user=mysql    

特別提示:

a.如果用mysql 5.05.1省略指定datadir會出錯。


5.設置常規方式啟動關閉腳本

cd /application/tools/mysql-5.5.32/

#拷貝mysql啟動腳本到/etc/init.d/

cp support-files/mysql.server /etc/init.d/mysqld

#授權700權限,即腳本可執行

chmod 700 /etc/init.d/mysqld

/etc/init.d/mysqldstart

chkconfig mysqld on

chkconfig --list mysqld


6.登錄mysql


7.簡單優化mysql

a.刪除test庫:

mysql>show databases;

+--------------------+

|Database           |

+--------------------+

|information_schema |

|mysql              |

|performance_schema |

|test               |

+--------------------+

4 rowsin set (0.03 sec)


mysql>drop database test;

Query OK, 0 rows affected (0.04 sec)


mysql>show databases;

+--------------------+

|Database           |

+--------------------+

|information_schema |

|mysql              |

|performance_schema |

+--------------------+

3 rowsin set (0.00 sec)


b.清除并修改管理員用戶

mysql>select user,host from mysql.user;  

+------+-----------+

| user| host      |

+------+-----------+

| root| 127.0.0.1 |

| root| ::1       |

|      | Mysql     |

| root| Mysql     |

|      | localhost |

| root| localhost |

+------+-----------+

6 rowsin set (0.00 sec)


mysql>delete from mysql.user;

QueryOK, 6 rows affected (0.07 sec)


mysql>select user,host from mysql.user;

Emptyset (0.00 sec)

mysql>grant all privileges on *.* to system@'localhost' identified by '1234' withgrant option;

QueryOK, 0 rows affected (0.00 sec)

mysql>flush privileges;

QueryOK, 0 rows affected (0.00 sec)

mysql>grant all privileges on *.* to system@'127.0.0.1' identified by '1234' withgrant option;        

QueryOK, 0 rows affected (0.00 sec)

mysql>select user,host from mysql.user;

+--------+-----------+

|user   | host      |

+--------+-----------+

|system | 127.0.0.1 |

|system | localhost |

+--------+-----------+

2 rowsin set (0.00 sec)


操作過程:

[root@mysqltools]# cat /etc/redhat-release

CentOSrelease 6.4 (Final)

[root@mysqltools]# uname -r

2.6.32-358.el6.x86_64

[root@mysqltools]# uname -m

x86_64


[root@mysqltools]# tar zxf cmake-2.8.8.tar.gz

[root@mysqltools]# cd cmake-2.8.8

[root@mysqlcmake-2.8.8]# ./configure

CMakehas bootstrapped.  Now run gmake.

[root@Mysqlcmake-2.8.8]# gmake

[root@Mysqlcmake-2.8.8]# gmake install

[root@Mysqlapplication]# groupadd mysql

[root@Mysqlapplication]# useradd mysql -s /sbin/nologin -M -g mysql

[root@Mysqltools]# tar zxf mysql-5.5.32.tar.gz

[root@Mysqltools]# cd mysql-5.5.32

[root@Mysqlmysql-5.5.32]# cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \

cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \

-DMYSQL_DATADIR=/application/mysql-5.5.32/data\

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\

-DDEFAULT_CHARSET=gbk\

-DDEFAULT_COLLATION=gbk_chinese_ci\

-DENABLED_LOCAL_INFILE=ON\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_FEDERATED_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\

-DWITHOUT_PARTITION_STORAGE_ENGINE=1


#Build files have been written to: /application/tools/mysql-5.5.32   如果顯示這個表示cmake成功


[root@Mysqlmysql-5.5.32]# make

[root@Mysqlmysql-5.5.32]# make install

[root@Mysqlmysql-5.5.32]# ln -s /application/mysql-5.5.32//application/mysql

[root@Mysqlmysql-5.5.32]# ll support-files/my*.cnf

-rw-r--r--1 root root  4759 Apr 25 18:19support-files/my-huge.cnf

-rw-r--r--1 root root 19809 Apr 25 18:19 support-files/my-innodb-heavy-4G.cnf

-rw-r--r--1 root root  4733 Apr 25 18:19support-files/my-large.cnf

-rw-r--r--1 root root  4744 Apr 25 18:19support-files/my-medium.cnf

-rw-r--r--1 root root  2908 Apr 25 18:19support-files/my-small.cnf

[root@Mysqlmysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf

[root@Mysqlmysql-5.5.32]# echo 'export PATH=/application/mysql/bin:$PATH'>>/etc/profile

[root@Mysqlmysql-5.5.32]# tail -1 /etc/profile

exportPATH=/application/mysql/bin:$PATH

[root@Mysqlmysql-5.5.32]# source /etc/profile

[root@Mysqlmysql-5.5.32]# echo $PATH

/application/mysql/bin:/application/mysql/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[root@Mysqlmysql-5.5.32]# mkdir -p /application/mysql/data

[root@Mysqlmysql-5.5.32]# chown -R mysql.mysql /application/mysql/*

[root@Mysqlmysql-5.5.32]# chmod -R 1777 /tmp

[root@Mysqlmysql-5.5.32]# /application/mysql/scripts/mysql_install_db--basedir=/application/mysql --datadir=/application/mysql/data--user=mysql  

[root@Mysqlmysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

[root@Mysqlmysql-5.5.32]# chmod 700 /etc/init.d/mysqld

[root@Mysqlmysql-5.5.32]# chkconfig mysqld on

[root@Mysqlmysql-5.5.32]# chkconfig --list mysqld

mysqld          0:off   1:off  2:on    3:on    4:on   5:on    6:off

root@Mysqlmysql-5.5.32]# mysql

Welcometo the MySQL monitor.  Commands end with; or \g.

YourMySQL connection id is 2

Serverversion: 5.5.32 Source distribution


Copyright(c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracleis a registered trademark of Oracle Corporation and/or its

affiliates.Other names may be trademarks of their respective

owners.


Type'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>


簡單優化mysql

a.刪除test庫:

mysql>show databases;

+--------------------+

|Database           |

+--------------------+

|information_schema |

|mysql              |

|performance_schema |

|test               |

+--------------------+

4 rowsin set (0.03 sec)


mysql>drop database test;

QueryOK, 0 rows affected (0.04 sec)


mysql>show databases;

+--------------------+

|Database           |

+--------------------+

|information_schema |

|mysql              |

|performance_schema |

+--------------------+

3 rowsin set (0.00 sec)


b.清除并修改管理員用戶

mysql>select user,host from mysql.user;  

+------+-----------+

| user| host      |

+------+-----------+

| root| 127.0.0.1 |

| root| ::1       |

|      | Mysql     |

| root| Mysql     |

|      | localhost |

| root| localhost |

+------+-----------+

6 rowsin set (0.00 sec)


mysql>delete from mysql.user;

Query OK, 6 rows affected (0.07 sec)


mysql>select user,host from mysql.user;

Emptyset (0.00 sec)

mysql>grant all privileges on *.* to system@'localhost' identified by '1234' withgrant option;

Query OK, 0 rows affected (0.00 sec)

mysql>flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql>grant all privileges on *.* to system@'127.0.0.1' identified by '1234' withgrant option;        

Query OK, 0 rows affected (0.00 sec)

mysql>select user,host from mysql.user;

+--------+-----------+

|user   | host      |

+--------+-----------+

|system | 127.0.0.1 |

|system | localhost |

+--------+-----------+

2 rowsin set (0.00


1CMAKE安裝Mysql時遇到的問題:

--Check size of wint_t - done

--Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)

CMakeError at cmake/readlineNaNake:83 (MESSAGE):

 Curses library not found.  Please install appropriate package,

     remove CMakeCache.txt and rerun cmake.OnDebian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it isncurses-devel.

CallStack (most recent call first):

 cmake/readlineNaNake:127 (FIND_CURSES)

 cmake/readlineNaNake:217(MYSQL_USE_BUNDLED_LIBEDIT)

 CMakeLists.txt:269 (MYSQL_CHECK_READLINE)

--Configuring incomplete, errors occurred!


解決方法:

rm CMakeCache.txt

yum install ncurses-devel -y

然后再cmake



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

建昌县| 新兴县| 漳州市| 永顺县| 陆良县| 永城市| 双流县| 肥东县| 霍城县| 监利县| 蒙自县| 永修县| 泸水县| 乌拉特后旗| 石城县| 冷水江市| 神池县| 封丘县| 稻城县| 博湖县| 集贤县| 翁牛特旗| 江陵县| 西平县| 吴江市| 上犹县| 洪泽县| 嘉祥县| 江都市| 咸阳市| 永仁县| 江孜县| 黄山市| 东城区| 永胜县| 新郑市| 乡宁县| 西平县| 黑河市| 南岸区| 邮箱|