真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

MySQL-5.5的二進(jìn)制包是如何安裝的

本文主要給大家簡(jiǎn)單講講MySQL-5.5的二進(jìn)制包是如何安裝的,相關(guān)專(zhuān)業(yè)術(shù)語(yǔ)大家可以上網(wǎng)查查或者找一些相關(guān)書(shū)籍補(bǔ)充一下,這里就不涉獵了,我們就直奔主題吧,希望MySQL-5.5的二進(jìn)制包是如何安裝的這篇文章可以給大家?guī)?lái)一些實(shí)際幫助。

創(chuàng)新互聯(lián)公司主要從事成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)蘭西,10年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專(zhuān)業(yè),歡迎來(lái)電咨詢(xún)建站服務(wù):028-86922220

環(huán)境:

[root@SQL-M ~]# cat /etc/redhat-release 

CentOS release 6.8 (Final)

[root@SQL-M ~]# uname -r

2.6.32-642.el6.x86_64

開(kāi)始安裝配置:

[root@SQL-M ~]# cd /usr/local/src/

[root@SQL-M src]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz

[root@SQL-M src]# ll -h

total 178M

-rw-r--r-- 1 root root 178M Apr 22 16:27 mysql-5.5.55-linux2.6-x86_64.tar.gz

MySQL-5.5的二進(jìn)制包是如何安裝的

[root@SQL-M src]# tar zxf mysql-5.5.55-linux2.6-x86_64.tar.gz -C /usr/local/   # 解壓

[root@SQL-M src]# cd ..

[root@SQL-M local]# mv mysql-5.5.55-linux2.6-x86_64/   mysql-5.5.55     # 改名

[root@SQL-M local]# ln -s mysql-5.5.55  mysql          # 做軟連接

[root@SQL-M local]# useradd mysql -s /sbin/nologin -M          # 建立系統(tǒng)用戶(hù)

[root@SQL-M local]# mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql             # 初始化數(shù)據(jù)庫(kù)

[root@SQL-M local]# chown -R mysql:mysql  mysql-5.5.55       # 對(duì)目錄授權(quán)

[root@SQL-M local]# vi /etc/my.cnf                      # 創(chuàng)建配置文件,測(cè)試用的

[client]
port=3306
socket= /usr/local/mysql/mysql.sock

[mysqld]
user    = mysql
datadir = /usr/local/mysql/data/
character-set-server = utf8
skip-character-set-client-handshake
init-connect = 'SET NAMES utf8'
open_files_limit=1024
back_log = 600
max_connections = 800
max_connect_errors = 3000
table_cache = 614
external-locking = FALSE
max_allowed_packet =8M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 100
thread_concurrency = 2
query_cache_size = 2M
query_cache_limit = 1M
query_cache_min_res_unit = 2k
thread_stack = 192K
tmp_table_size = 2M
max_heap_table_size = 2M
log-bin = /usr/local/mysql/data/mysql-bin
binlog_cache_size = 1M
max_binlog_cache_size = 1M
max_binlog_size = 2M
expire_logs_days = 7
key_buffer_size = 16M
read_buffer_size = 1M
read_rnd_buffer_size = 1M
bulk_insert_buffer_size = 1M
lower_case_table_names = 1
skip-name-resolve
slave-skip-errors = 1032,1062
replicate-ignore-db=mysql
server-id = 1
innodb_additional_mem_pool_size = 4M
innodb_buffer_pool_size = 16M
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 4M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

[mysqldump]
quick
max_allowed_packet = 2M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[root@SQL-M local]# cp mysql/bin/* sbin/    # 復(fù)制執(zhí)行命令到 sbin 下

[root@SQL-M local]# cp mysql/support-files/mysql.server /etc/init.d/mysqld  # 生成啟動(dòng)腳本

[root@SQL-M local]# /etc/init.d/mysqld start      # 直接啟動(dòng)服務(wù)

Starting MySQL...... SUCCESS! 

[root@SQL-M ~]# netstat -lntup                    # 查看服務(wù)

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      7853/mysqld 

[root@SQL-M ~]# lsof -i:3306

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

mysqld  7853 mysql   12u  IPv4  24118      0t0  TCP *:mysql (LISTEN)

[root@SQL-M local]# mysqladmin -u root password      # 給 root 密碼,默認(rèn)免密登錄

Enter password: 

[root@SQL-M local]# mysql -uroot -p             # 交互式密碼登錄

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.55-log MySQL Community Server (GPL)

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

Oracle is 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> show databases;

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

| Database           |

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

| information_schema |

| mysql              |

| performance_schema |

| test               |

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

4 rows in set (0.13 sec)

mysql> drop database test;             # 刪掉測(cè)試庫(kù)

Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from mysql.user;

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

| user   | host      |

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

| root | 127.0.0.1 |

| root | ::1            |

|         | localhost |

| root | localhost |

|         | sql-m      |

| root | sql-m      |

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

6 rows in set (0.11 sec)

mysql> drop user root@'::1';              # 把沒(méi)用的用戶(hù)刪除

Query OK, 0 rows affected (0.14 sec)

mysql> drop user ''@localhost;

Query OK, 0 rows affected (0.00 sec)

mysql> drop user ''@'sql-m';

Query OK, 0 rows affected (0.00 sec)

mysql> drop user root@'sql-m';

Query OK, 0 rows affected (0.03 sec)

mysql> select user,host from mysql.user;

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

| user | host      |

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

| root | 127.0.0.1 |

| root | localhost |

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

2 rows in set (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> quit

[root@SQL-M local]# mysqladmin -uroot -p123 password    # 改密碼

New password: 

Confirm new password:

測(cè)試忘記root密碼重新找回:

[root@SQL-M ~]# /etc/init.d/mysqld stop       # 先停掉服務(wù)

Shutting down MySQL.. SUCCESS! 

[root@SQL-M ~]# mysqld_safe --skip-grant-tables &    # 忽略授權(quán)表方式啟動(dòng)服務(wù)

[1] 3685

170422 17:37:34 mysqld_safe Logging to '/var/log/mysqld.log'.

170422 17:37:34 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

[root@SQL-M ~]# 170422 17:37:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[1]+  Done                    mysqld_safe --skip-grant-tables

奇怪居然失敗了!看一下日志先。。。

[root@SQL-M ~]# tail /var/log/mysqld.log 

170422 17:39:41  InnoDB: Waiting for the background threads to start

170422 17:39:42 InnoDB: 5.5.55 started; log sequence number 1595668

170422 17:39:42 [Note] Recovering after a crash using /usr/local/mysql/data/mysql-bin

170422 17:39:42 [Note] Starting crash recovery...

170422 17:39:42 [Note] Crash recovery finished.

170422 17:39:42 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306

170422 17:39:42 [Note]   - '0.0.0.0' resolves to '0.0.0.0';

170422 17:39:42 [Note] Server socket created on IP: '0.0.0.0'.

170422 17:39:42 [ERROR] /usr/local/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)

170422 17:39:42 [ERROR] Can't start server: can't create PID file: No such file or directory

可以看到,無(wú)法創(chuàng)建 pid 文件,這肯定是沒(méi)權(quán)限造成的。

/var/run/mysqld 這個(gè)路徑是配置文件里配的:

[root@SQL-M ~]# tail -3 /etc/my.cnf 

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

   這里有點(diǎn)奇怪,用 /etc/init.d/mysqld 啟動(dòng)服務(wù)時(shí)它不會(huì)讀取配置文件里配置的 pid 路徑,而用 mysqld_safe --skip-grant-tables & 忽略授權(quán)表方式啟動(dòng)服務(wù)卻會(huì)讀取配置文件里的 pid 路徑。

不想動(dòng) /var/log/ 這個(gè)目錄的權(quán)限,改配置文件

[root@SQL-M ~]# vim /etc/my.cnf 

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/usr/local/mysql/mysqld.pid

[root@SQL-M ~]# /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &   # 再次執(zhí)行

[1] 7109

170422 17:54:17 mysqld_safe Logging to '/var/log/mysqld.log'.

170422 17:54:17 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

[root@SQL-M ~]#                            # 這次可以了

[root@SQL-M ~]# mysql                 # 免密登錄

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.55-log MySQL Community Server (GPL)

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

Oracle is 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> update mysql.user set password=password('123') where user='root' and host='localhost';                               # 修改密碼

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;                   # 刷新后退出用新密碼登錄

Query OK, 0 rows affected (0.19 sec)

以上二進(jìn)制包簡(jiǎn)單安裝完成。

MySQL-5.5的二進(jìn)制包是如何安裝的就先給大家講到這里,對(duì)于其它相關(guān)問(wèn)題大家想要了解的可以持續(xù)關(guān)注我們的行業(yè)資訊。我們的板塊內(nèi)容每天都會(huì)捕捉一些行業(yè)新聞及專(zhuān)業(yè)知識(shí)分享給大家的。


名稱(chēng)欄目:MySQL-5.5的二進(jìn)制包是如何安裝的
當(dāng)前URL:http://weahome.cn/article/gjjgoj.html

其他資訊

在線咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部