Centos5.5中安裝Mysql5.5過程分享_MySQL教程
推薦:/var/log/pacct文件導(dǎo)致MySQL啟動失敗的案例分享毫無預(yù)兆的,MySQL 罷工了。 用 mysql.server 啟動腳本啟動之后,沒有任何提示信息就結(jié)束,mysqld進(jìn)程自然是沒有起來。 把 mysql.server 里面 $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file /dev/null 21 這句的輸出重定向去掉后運行,結(jié)果發(fā)現(xiàn)
這幾天在centos下裝mysql,這里記錄一下安裝的過程,方便以后查閱
Mysql5.5.37安裝需要cmake,5.6版本開始都需要cmake來編譯,5.5以后的版本應(yīng)該也要裝這個。
安裝cmake
代碼如下:
[root@local ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[root@local ~]# tar xvf cmake-2.8.12.2.tar.gz
[root@local ~]# cd cmake-2.8.12.2
[root@local cmake-2.8.12.2]#./bootstrap
[root@local cmake-2.8.12.2]# make
[root@local cmake-2.8.12.2]# make install
安裝mysql
代碼如下:
[root@local ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
[root@local ~]# tar xvf mysql-5.5.37.tar.gz
[root@local ~]# cd mysql-5.5.37
[root@local mysql-5.5.37]# cmake ./
可能還會報這個錯,沒有就跳過
代碼如下:
CMake Error at cmake/readline.cmake:83(MESSAGE):
Curses library not found. Pleaseinstall appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:127 (FIND_CURSES)
cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:355 (MYSQL_CHECK_READLINE
-- Configuring incomplete, errors occurred!
See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log".
See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log".
說明centos系統(tǒng)沒有ncurses-devel
代碼如下:
[root@local ~]# wget http://invisible-island.net/datafiles/release/ncurses.tar.gz
[root@local ~]# cd ncurses-5.9
[root@local ncurses-5.9]#./configure
[root@local ncurses-5.9]# make
[root@local ncurses-5.9]# make install
再刪除剛才編譯生成的 CMakeCache.txt 文件,否則無法進(jìn)行下一步
代碼如下:
[root@local mysql-5.5.37]# rm -f CMakeCache.txt
繼續(xù)編譯mysql
代碼如下:
[root@local ~]# cmake ./
[root@local ~]# make
[root@local ~]# make install
這樣,mysql默認(rèn)將成功安裝到/usr/local/mysql
創(chuàng)建mysql用戶組
代碼如下:
[root@local ~]# groupadd mysql
[root@local ~]# useradd –r –g mysql mysql
[root@local ~]# chown –R mysql.mysql /usr/local/mysql
啟動mysql
代碼如下:
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
這里可能會發(fā)生錯誤,沒有就跳過:
代碼如下:
FATAL ERROR: Could not find./bin/my_print_defaults
If you compiled from source, you need torun 'make install' to
copy the software into the correct locationready for operation.
If you are using a binary release, you musteither be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
解決方法:
代碼如下:
[root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
再啟動mysql
代碼如下:
[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql
注冊mysql服務(wù),開機(jī)自動啟動
1.設(shè)置mysql配置文件到/etc目錄
代碼如下:
[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf
2.設(shè)置mysql開機(jī)自啟
代碼如下:
[root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@local ~]# chmod +x /etc/init.d/mysql
[root@local ~]# /sbin/chkconfig --add mysql
3.啟動mysql服務(wù)
代碼如下:
[root@local ~]# service mysql start
測試mysql是否安裝成功
代碼如下:
[root@local ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37 Source distribution
Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.03 sec)
分享:MySQL中在查詢結(jié)果集中得到記錄行號的方法如果需要在查詢語句返回的列中包含一列表示該條記錄在整個結(jié)果集中的行號, ISO SQL:2003 標(biāo)準(zhǔn)提出的方法是提供 ROW_NUMBER() / RANK() 函數(shù)。 Oracle 中可以使用標(biāo)準(zhǔn)方法(8i版本以上),也可以使用非標(biāo)準(zhǔn)的 ROWNUM ; MS SQL Server 則在 2005 版本中提供了 ROW_NUMB
- /var/log/pacct文件導(dǎo)致MySQL啟動失敗的案例分享
- MySQL中在查詢結(jié)果集中得到記錄行號的方法
- CentOS下php使用127.0.0.1不能連接mysql的解決方法
- 如何配置MySQL主從復(fù)制
- MySQL 備份和恢復(fù)策略詳細(xì)教程
- Apache服務(wù)器下使用 ab 命令進(jìn)行壓力測試
- MySQL下的NoSQL解決方案HandlerSocket
- MySQL引擎 學(xué)習(xí)筆記
- navicat如何連接mysql?navicat連接mysql詳細(xì)圖文教程
- 如何從Windows命令行啟動MySQL
- 你應(yīng)該知道的10個MySQL客戶啟動選項
- MySQL十條特殊技巧
MySQL教程Rss訂閱編程教程搜索
MySQL教程推薦
猜你也喜歡看這些
- 解答SQL Server日志文件損壞嚴(yán)重的問題
- Sql學(xué)習(xí)第三天——SQL 關(guān)于with ties介紹
- 揭秘Sql語句優(yōu)化注意事項
- SQL Server 索引基礎(chǔ)知識(1)--- 記錄數(shù)據(jù)的基本格式
- SQL Server 2000 中使用正則表達(dá)式
- SQL Server中怎么得到自動編號字段解析
- 微軟數(shù)據(jù)平臺開發(fā)與SQL Server 2008
- 詳細(xì)解析SQL Server安裝sp4補丁報錯的方法
- 剖析SQL Server 2005查詢通知之基礎(chǔ)篇
- SQL Server導(dǎo)出導(dǎo)入數(shù)據(jù)方法
- 相關(guān)鏈接:
- 教程說明:
MySQL教程-Centos5.5中安裝Mysql5.5過程分享。