CentOS6.5和RedHat6.5下以rpm方式安裝mysql-5.6.20

來源:互聯網
上載者:User

標籤:

轉帖;http://blog.csdn.net/mw08091020/article/details/39234207a.檢查下linux是不是已經安裝了mysql
rpm -qa | grep -i mysql#如果安裝了先卸載舊的版本    yum -y remove mysql...

b.下載需要的安裝包,:

http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.20-1.el6.x86_64.rpmhttp://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.20-1.el6.x86_64.rpm

c、開始逐個安裝

rpm -ivh MySQL-server-5.6.20-1.el6.x86_64.rpmrpm -ivh MySQL-devel-5.6.20-1.el6.x86_64.rpmrpm -ivh MySQL-client-5.6.20-1.el6.x86_64.rpm

d.修改設定檔位置並做相關設定

cp /usr/share/mysql/my-default.cnf /etc/my.cnfvi /etc/my.cnf#做如下配置  [client]password = 123456port = 3306default-character-set=utf8[mysqld]port = 3306character_set_server=utf8character_set_client=utf8collation-server=utf8_general_ci#linux下mysql安裝完後是預設:表名區分大小寫,列名不區分大小寫; 0:區分大小寫,1:不區分大小寫lower_case_table_names=1#設定最大串連數,預設為 151,MySQL伺服器允許的最大串連數16384max_connections=1000[mysql]default-character-set = utf8 

e.初始化MySQL及設定密碼

/usr/bin/mysql_install_dbservice mysql start

f.登入到mysql,第一次裝沒有密碼,直接斷行符號

mysql -uroot -p#設定root使用者的密碼mysql> update user set password=password(‘123456‘) where user=‘root‘;

g.設定允許遠程登入

mysql> use mysql;mysql> select host,user,password from user;mysql> update user set host=‘%‘ where user=‘root‘ and host=‘localhost‘;mysql> flush privileges;mysql> exit;

h.設定開機自啟動

chkconfig mysql onchkconfig --list | grep mysql

i. MySQL的預設安裝位置說明

/var/lib/mysql/   #資料庫目錄/usr/share/mysql  #設定檔目錄/usr/bin          #相關命令目錄/etc/init.d/mysql #啟動指令碼                                                                                     註:卸載mysql的時候,將這些目錄下的檔案也刪掉。
j.可能遇到的錯誤(一)
2014-01-21 06:03:29 14964 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if      non-zero) pages!2014-01-21 06:03:29 14964 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you   should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of  zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!2014-01-21 06:03:29 14964 [ERROR] Plugin ‘InnoDB‘ init function returned error.2014-01-21 06:03:29 14964 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.2014-01-21 06:03:29 14964 [ERROR] Unknown/unsupported storage engine: InnoDB2014-01-21 06:03:29 14964 [ERROR] Aborting在/var/lib/mysql/目錄下刪掉這三個檔案:ibdata1 ib_logfile0 ib_logfile1 然後重啟mysqlcd /var/lib/mysqlrm ibdata1 ib_logfile0 ib_logfile1service mysql start
k.可能遇到的錯誤(二)
[[email protected] local]# mysql -uroot -pEnter password: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)方法操作很簡單,如下:# /etc/init.d/mysql stop# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &# mysql -u root mysql//把空的使用者密碼都修改成非空的密碼。mysql> UPDATE user SET Password=PASSWORD(‘newpassword‘) where USER=‘root‘ and host=‘root‘ or host=‘localhost‘;mysql> FLUSH PRIVILEGES;mysql> quit # /etc/init.d/mysqld restart# mysql -uroot -pEnter password: <輸入新設的密碼newpassword>
l.可能遇到的錯誤(三)
mysql> show databases;ERROR 1820 (HY000): You must SET PASSWORD before executing this statement這句話要求你重新設定一次密碼!mysql>  SET PASSWORD = PASSWORD(‘123456‘);Query OK, 0 rows affected (0.03 sec)mysql> create database roger;Query OK, 1 row affected (0.00 sec)
參考:http://blog.csdn.net/liumm0000/article/details/18841197

CentOS6.5和RedHat6.5下以rpm方式安裝mysql-5.6.20

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.