歡迎您光臨本站 註冊首頁

linux mysql配置與說明

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

linux mysql配置與說明

一、軟體安裝
 1. 安裝MySQL
 (1) 解開壓縮包
cd /usr/local
  tar -zvxf mysql-3.23.32.tar.gz
(2) 編譯MySQL
cd /usr/local/mysql
./configure --prefix=/usr/local/mysql
make
make install
(3) 安裝資料庫文件
/usr/local/mysql/scripts/mysql_install_db
/usr/local/mysql/bin/safe_mysqld & (5)/usr/local/mysql/bin/mysql_install_db –user=mysql (6)chown –R mysql /usr/loca/mysql/var (7)/usr/local/mysql/bin/mysqld_safe & //啟動mysql (8)/usr/loca/mysql/bin/mysqladmin –u root password 123456 //設置mysql密碼 二、mysql授權內外網訪問 >use mysql; > grant ALL PRIVILEGES ON *.* to [email protected]"%" identified by "root123" WITH GRANT OPTION;

三、碰到mysql的疑難問題,解決方法

關於mysql以下錯誤的解決方法 [[email protected] bin]# ./mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 1.#ps -A|grep mysql
顯示類似:
1829 ? 00:00:00 mysqld_safe
1876 ? 00:00:31 mysqld
2.#kill -9 1829
3.#kill -9 1876
4.#/etc/init.d/mysql restart
5.#mysql -u root -p 四、關於外網用工具連接linux伺服器裡面的mysql出現的故障問題與解決方法 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock

以上這個現象是我在虛擬機上面裝碰到的問題的錯誤提示.


[email protected] ~]# mysql --socket=/tmp/mysql.sock
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


解決方法:


由於mysql 默認的mysql.sock 是在/var/lib/mysql/mysql.sock,但linux系統總是去/tmp/mysql.sock查找,會報錯

[[email protected] ~]# find / -name mysql.sock
/var/lib/mysql/mysql.sock

1.直接指定mysql通道

[[email protected] ~]# mysql --socket=/var/lib/mysql/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2 to server version: 5.0.22

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>

2. 創建符號連接:

為mysql.sock增加軟連接(相當於windows中的快捷方式).

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock


顯示:
[email protected] ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[[email protected] ~]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
[[email protected] ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3 to server version: 5.0.22

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>


本文出自 「騰飛與夢想攜行」 博客,謝絕轉載!


[火星人 ] linux mysql配置與說明已經有738次圍觀

http://coctec.com/docs/linux/show-post-48533.html