以上更詳細的內(nèi)容地址:http://jingyan.baidu.com/article/a378c9609eb652b3282830fd.html 注意問題: 自我感覺mysql 5.7這一系列的版本都很變態(tài)啊,不管是windows的還是Linux,安裝的時候總會出些莫名其妙的想法。當初在windows下安裝mysql的時候,年輕不懂事下了5.7版本的,結(jié)果出現(xiàn)了各種難以捉摸的bug,在網(wǎng)上查也找不到,最后發(fā)現(xiàn)一個同病相憐的人訴說是版本問題,裝成5.6就好了。而這次裝linux的,年少輕狂的我忘記了windows下的教訓(xùn),裝了5.7,結(jié)果一直出現(xiàn)各種bug,哎,還是太年輕了。希望大家能吸取教訓(xùn)吧。 9.安裝完后的使用 安裝完以后,大家可以輸入mysql -uroot -p,然后enter password來進入mysql。 進去后可以使用mysql的各種語法,首先可以查看database:show databases。 Linux下mysql的卸載: 1、查找以前是否裝有mysql 命令:rpm -qa|grep -i mysql 可以看到mysql的兩個包: mysql-4.1.12-3.RHEL4.1 mysqlclient10-3.23.58-4.RHEL4.1 2、刪除mysql 刪除命令:rpm -e --nodeps 包名 ( rpm -ev mysql-4.1.12-3.RHEL4.1 ) 3、刪除老版本mysql的開發(fā)頭文件和庫 檢查各個mysql文件夾是否刪除干凈 find / -name mysql 結(jié)果如下: /var/lib/mysql /usr/local/mysql /usr/lib/mysql /usr/include/mysql 命令: rm -fr /usr/lib/mysql rm -fr /usr/include/mysql 注意:卸載后/var/lib/mysql中的數(shù)據(jù)及/etc/my.cnf不會刪除,如果確定沒用后就手工刪除 rm -f /etc/my.cnf rm -fr /var/lib/mysql 4.刪除mysql用戶及用戶組 userdel mysql groupdel mysql Linux下創(chuàng)建和刪除軟鏈接: 1.先建立一個軟連接 1 [root@rekfan.com test]# ls -il 2 總計 0 3 1491138 -rw-r–r– 1 root root 48 07-14 14:17 file1 4 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2 5 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand 6 #建立file1和file1soft軟連接 7 [root@rekfan.com test]# ln -s file1 file1soft 8 [root@rekfan.com test]# ls -il 9 總計 010 1491138 -rw-r–r– 1 root root 48 07-14 14:17 file111 1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file112 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file213 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand 其中,ln -s file1 filesoft 中的file1就是源文件,file1soft就是目標鏈接文件名,其作用是當進入filesoft目錄,實際上是鏈接進入了file1目錄 2.刪除上面建立的軟連接 1 [root@rekfan.com test]# ls -il 2 總計 0 3 1491138 -rw-r–r– 1 root root 0 07-14 14:17 file1 4 1491140 lrwxrwxrwx 1 root root 5 07-14 14:24 file1soft -> file1 5 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2 6 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand 7 #刪除軟連接 8 [root@rekfan.com test]# rm -rf file1soft 9 [root@rekfan.com test]# ls -il10 總計 011 1491138 -rw-r–r– 1 root root 0 07-14 14:17 file112 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file213 1491139 -rw-r–r– 2 root root 0 07-14 14:17 file2hand 啟動mysql時顯示:/tmp/mysql.sock 不存在的解決方法1 [root@localhost mysql]# bin/mysqladmin -u root password root2 bin/mysqladmin: connect to server at 'localhost' failed3 error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'4 Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!5 [root@localhost mysql]# bin/mysql -u root -p6 Enter password:7 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)8 分析:是/tmp/mysql.sock 不存在 由于搜索的mysql.sock路徑是在/tmp下,而mysql安裝的mysql.sock在/var/lib/mysql下,所以選擇建立符號(軟)連接: 1 # ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock2 # bin/mysql -u root3 Welcome to the MySQL monitor. Commands end with ; or g.4 Your MySQL connection id is 15 Server version: 5.0.45 MySQL Community Server (GPL)6 Type 'help;' or 'h' for help. Type 'c' to clear the buffer.7 mysql> 安裝mysql報錯:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper解決方法 :安裝autoconf庫 命令:yum-y install autoconf //此包安裝時會安裝Data:Dumper模塊 Centos 7以上啟動mysql報錯:Starting MySQL. ERROR! The server quit without updating PID file (/var/lib/mysql/bj-dev2.pid).1、可能是/usr/local/mysql/data/mysql.pid文件沒有寫的權(quán)限 |
|
來自: kangyongsun > 《安裝Mysql》