这里通过yum 安装
[root@t home]# yum install mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: ftp://ftp.hostrino.com/
* base: centos.mirror.cdnetworks.com
* extras: centos.mirror.cdnetworks.com
* updates: data.nicehosting.co.kr
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
http://data.nicehosting.co.kr/os/CentOS/5.5/updates/i386/repodata/repomd.xml: [Errno 14] HTTP Error 403: Forbidden
Trying other mirror.
updates | 1.9 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.0.77-4.el5_5.3 set to be updated
--> Processing Dependency: mysql = 5.0.77-4.el5_5.3 for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Running transaction check
---> Package mysql.i386 0:5.0.77-4.el5_5.3 set to be updated
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
mysql-server i386 5.0.77-4.el5_5.3 updates 9.8 M
Installing for dependencies:
mysql i386 5.0.77-4.el5_5.3 updates 4.8 M
perl-DBD-MySQL i386 3.0007-2.el5 base 148 k
perl-DBI i386 1.52-2.el5 base 600 k
Transaction Summary
================================================================================
Install 4 Package(s)
Upgrade 0 Package(s)
Total download size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): perl-DBD-MySQL-3.0007-2.el5.i386.rpm | 148 kB 00:02
(2/4): perl-DBI-1.52-2.el5.i386.rpm | 600 kB 00:10
(3/4): mysql-5.0.77-4.el5_5.3.i386.rpm | 4.8 MB 01:24
(4/4): mysql-server-5.0.77-4.el5_5.3.i386.rpm | 9.8 MB 02:51
--------------------------------------------------------------------------------
Total 57 kB/s | 15 MB 04:31
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI 1/4
Installing : mysql 2/4
Installing : perl-DBD-MySQL 3/4
Installing : mysql-server 4/4
Installed:
mysql-server.i386 0:5.0.77-4.el5_5.3
Dependency Installed:
mysql.i386 0:5.0.77-4.el5_5.3 perl-DBD-MySQL.i386 0:3.0007-2.el5
perl-DBI.i386 0:1.52-2.el5
Complete!
You have mail in /var/spool/mail/root
[root@t home]#
初始化 MySQL 数据库: Installing MySQL system tables...
100612 9:12:28 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
100612 9:12:28 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
100612 9:12:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
100612 9:12:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
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 t.pipc.net 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.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com/
Support MySQL by buying support/licenses at http://shop.mysql.com/
[确定]
启动 MySQL: [确定]
[root@t home]#
chkconfig --add mysqld 在服务清单中添加mysql服务
chkconfig mysqld on 设置mysql服务开机启动
service mysqld start 服务启动
mysqladmin -u root password '111111' 更改密码
mysqladmin -u root -p111111 password '222222' 修改密码
通过客户端连接,输入密码就可以了:
mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
mysql> DROP DATABASE test; 删除test数据库
mysql> DELETE FROM mysql.user WHERE user = ''; 删除匿名帐户
mysql> FLUSH PRIVILEGES; 重载权限
添加mysql用户:
GRANT ALL PRIVILEGES ON my_db.* TO 'user'@'localhost' IDENTIFIED BY 'password';
安装上mysql扩展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
设置默认编码等一些初始参数(my.cnf)
vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
default-character-set=utf8
default-storage-engine=INNODB # INNODB 模式十分占用内容, 在内存小的服务器上不要用INNODB
old_passwords=1
[client]
default-character-set=utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
grant all PRIVILEGES on db.* to root2@'192.168.0.38' identified by '111111';
设置root2 账户允许38这台计算机远程连接,root2密码为111111
浙公网安备 33010602011771号