# 038. 在 linux 虚拟机中安装部署 MySQL 数据库
后面写的各种代码,还是要基于 mysql 去做一些开发的,因为缓存的底层的数据存储肯定是数据库
mysql 部署在 eshop-cache04 机器上。
使用 yum 方式安装
# 安装的版本是 Server version: 5.1.73 Source distribution
yum install -y mysql-server
# 启动 mysql
service mysqld start
# 配置开机启动
chkconfig mysqld on
mysql
mysql> show databases
# 安装客户端,该软件的作用是什么?因为不安装也能使用 mysql 进入客户端
yum install -y mysql-connector-java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
关于密码的修改,在启动日志中有
[root@eshop-cache04 local]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
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 eshop-cache04 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 /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36