程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> Centos上安裝Mysql

Centos上安裝Mysql

編輯:MySQL綜合教程

Centos上安裝Mysql


操作系統信息:

[vagrant@localhost ~]$ uname -a

Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


1、sudo yum install Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64.rpm

[vagrant@localhost download]$ sudo yum install Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64.rpm

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: ftp.riken.jp

* extras: ftp.riken.jp

* updates: ftp.riken.jp

Setting up Install Process

Examining Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64.rpm: Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64

Marking Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package Percona-Server-shared-55.x86_64 0:5.5.37-rel35.0.el6 will be installed

--> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64

--> Processing Dependency: libssl.so.10(libssl.so.10)(64bit) for package: Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64

--> Running transaction check

---> Package openssl.x86_64 0:1.0.0-27.el6_4.2 will be updated

--> Processing Dependency: openssl = 1.0.0-27.el6_4.2 for package: openssl-devel-1.0.0-27.el6_4.2.x86_64

---> Package openssl.x86_64 0:1.0.1e-30.el6_6.5 will be an update

--> Running transaction check

---> Package openssl-devel.x86_64 0:1.0.0-27.el6_4.2 will be updated

---> Package openssl-devel.x86_64 0:1.0.1e-30.el6_6.5 will be an update

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================

Package Arch Version Repository Size

==============================================================================================================

Installing:

Percona-Server-shared-55 x86_64 5.5.37-rel35.0.el6 /Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64 3.0 M

Updating for dependencies:

openssl x86_64 1.0.1e-30.el6_6.5 updates 1.5 M

openssl-devel x86_64 1.0.1e-30.el6_6.5 updates 1.2 M


Transaction Summary

==============================================================================================================

Install 1 Package(s)

Upgrade 2 Package(s)


Total size: 5.6 M

Total download size: 2.7 M

Is this ok [y/N]: y

Downloading Packages:

(1/2): openssl-1.0.1e-30.el6_6.5.x86_64.rpm | 1.5 MB 00:05

(2/2): openssl-devel-1.0.1e-30.el6_6.5.x86_64.rpm | 1.2 MB 00:06

--------------------------------------------------------------------------------------------------------------

Total 225 kB/s | 2.7 MB 00:12

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Updating : openssl-1.0.1e-30.el6_6.5.x86_64 1/5

Installing : Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64 2/5

Updating : openssl-devel-1.0.1e-30.el6_6.5.x86_64 3/5

Cleanup : openssl-devel-1.0.0-27.el6_4.2.x86_64 4/5

Cleanup : openssl-1.0.0-27.el6_4.2.x86_64 5/5

Verifying : openssl-1.0.1e-30.el6_6.5.x86_64 1/5

Verifying : Percona-Server-shared-55-5.5.37-rel35.0.el6.x86_64 2/5

Verifying : openssl-devel-1.0.1e-30.el6_6.5.x86_64 3/5

Verifying : openssl-devel-1.0.0-27.el6_4.2.x86_64 4/5

Verifying : openssl-1.0.0-27.el6_4.2.x86_64 5/5


Installed:

Percona-Server-shared-55.x86_64 0:5.5.37-rel35.0.el6


Dependency Updated:

openssl.x86_64 0:1.0.1e-30.el6_6.5 openssl-devel.x86_64 0:1.0.1e-30.el6_6.5


Complete!


2、sudo yum install Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64.rpm

[vagrant@localhost download]$ sudo yum install Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64.rpm

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: ftp.riken.jp

* extras: ftp.riken.jp

* updates: ftp.riken.jp

Setting up Install Process

Examining Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64.rpm: Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64

Marking Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package Percona-Server-devel-55.x86_64 0:5.5.37-rel35.0.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================

Package Arch Version Repository Size

==============================================================================================================

Installing:

Percona-Server-devel-55 x86_64 5.5.37-rel35.0.el6 /Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64 4.4 M


Transaction Summary

==============================================================================================================

Install 1 Package(s)


Total size: 4.4 M

Installed size: 4.4 M

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64 1/1

Verifying : Percona-Server-devel-55-5.5.37-rel35.0.el6.x86_64 1/1


Installed:

Percona-Server-devel-55.x86_64 0:5.5.37-rel35.0.el6



3、sudo yum install Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64.rpm

[vagrant@localhost download]$ sudo yum install Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64.rpm

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: ftp.riken.jp

* extras: ftp.riken.jp

* updates: ftp.riken.jp

Setting up Install Process

Examining Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64.rpm: Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64

Marking Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package Percona-Server-client-55.x86_64 0:5.5.37-rel35.0.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================

Package Arch Version Repository Size

==============================================================================================================

Installing:

Percona-Server-client-55 x86_64 5.5.37-rel35.0.el6 /Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64 29 M


Transaction Summary

==============================================================================================================

Install 1 Package(s)


Total size: 29 M

Installed size: 29 M

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64 1/1

Verifying : Percona-Server-client-55-5.5.37-rel35.0.el6.x86_64 1/1


Installed:

Percona-Server-client-55.x86_64 0:5.5.37-rel35.0.el6


Complete!


4、sudo yum install Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64.rpm

[vagrant@localhost download]$ sudo yum install Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64.rpm

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: ftp.riken.jp

* extras: ftp.riken.jp

* updates: ftp.riken.jp

Setting up Install Process

Examining Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64.rpm: Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64

Marking Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package Percona-Server-server-55.x86_64 0:5.5.37-rel35.0.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


==============================================================================================================

Package Arch Version Repository Size

==============================================================================================================

Installing:

Percona-Server-server-55 x86_64 5.5.37-rel35.0.el6 /Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64 65 M


Transaction Summary

==============================================================================================================

Install 1 Package(s)


Total size: 65 M

Installed size: 65 M

Is this ok [y/N]: y

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64 1/1

Error in my_thread_global_end(): 1 threads didn't exit

Error in my_thread_global_end(): 1 threads didn't exit


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:


/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'


Alternatively you can run:

/usr/bin/mysql_secure_installation


which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.


See the manual for more instructions.


Please report any problems at

https://bugs.launchpad.net/percona-server/+filebug


Percona recommends that all production deployments be protected with a support

contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,

be eligible for hot fixes, and boost your team's productivity.

Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.

Run the following commands to create these functions:

mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"

mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"

mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"

See http://www.percona.com/doc/percona-server/5.5/management/udf_percona_toolkit.html for more details

Verifying : Percona-Server-server-55-5.5.37-rel35.0.el6.x86_64 1/1


Installed:

Percona-Server-server-55.x86_64 0:5.5.37-rel35.0.el6


Complete!


5、啟動mysql

[vagrant@localhost download]$ chkconfig --list | grep mysql

mysql 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉

[vagrant@localhost download]$ sudo service mysql start

Starting MySQL (Percona Server)..... SUCCESS!

[vagrant@localhost download]$ sudo netstat -ntlp | grep mysql

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

6、創建mysql 用戶

非root創建失敗。

[vagrant@localhost ~]$ mysql

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

Your MySQL connection id is 2

Server version: 5.5.37-35.0 Percona Server (GPL), Release rel35.0, Revision 657


Copyright (c) 2009-2014 Percona LLC and/or its affiliates

Copyright (c) 2000, 2014, 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> CREATE USER dummy IDENTIFIED BY '123';

ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation

root權限創建成功。

[vagrant@localhost ~]$ sudo mysql

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

Your MySQL connection id is 3

Server version: 5.5.37-35.0 Percona Server (GPL), Release rel35.0, Revision 657


Copyright (c) 2009-2014 Percona LLC and/or its affiliates

Copyright (c) 2000, 2014, 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> CREATE USER dummy IDENTIFIED BY '123';

Query OK, 0 rows affected (0.03 sec)


mysql> GRANT ALL ON *.* TO dummy;

Query OK, 0 rows affected (0.01 sec)

7、用新增用戶登錄mysql

[vagrant@localhost ~]$ sudo mysql -udummy -p

Enter password:

ERROR 1045 (28000): Access denied for user 'dummy'@'localhost' (using password: YES)

暈。。。。。。新增用戶無法登錄數據庫。。。。。

原因暫時未找到。。。

繼續用默認的root的賬號。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved