File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 112
112
- ` du -sh /opt ` ,查看 opt 这个文件夹大小 (h 的意思 human-readable 用人类可读性较好方式显示,系统会自动调节单位,显示合适大小的单位)
113
113
- ` du -sh ./* ` ,查看当前目录下所有文件夹大小 (h 的意思 human-readable 用人类可读性较好方式显示,系统会自动调节单位,显示合适大小的单位)
114
114
- ` cat /etc/resolv.conf ` ,查看 DNS 设置
115
- - ``,
116
- - ``,
115
+ - ` cat /etc/group ` ,查看所有组
116
+ - ` cat /etc/passwd ` ,查看所有用户
117
117
- ``,
118
118
- ``,
119
119
- ``,
Original file line number Diff line number Diff line change 31
31
- ` sudo cp /usr/program/mysql-5.6.29/support-files/mysql.server /etc/init.d/mysql `
32
32
- ` sudo chmod 755 /etc/init.d/mysql `
33
33
- ` sudo chkconfig mysql on `
34
- - 初始化数据库:` sudo /usr/program/mysql/scripts/mysql_install_db --basedir=/usr/program/mysql --datadir=/usr/program/mysql/data --skip-name-resolve --user=mysql `
35
34
- 复制一份配置文件: ` sudo cp /usr/program/mysql-5.6.29/support-files/my-default.cnf /etc/my.cnf `
36
35
- 删除安装的目录:` rm -rf /usr/program/mysql-5.6.29/ `
37
36
- 添加组和用户及安装目录权限
38
37
- ` sudo groupadd mysql ` #添加组
39
38
- ` sudo useradd -g mysql mysql -s /bin/false ` #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统
40
39
- ` sudo chown -R mysql:mysql /usr/program/mysql/data ` #设置MySQL数据库目录权限
40
+ - 初始化数据库:` sudo /usr/program/mysql/scripts/mysql_install_db --basedir=/usr/program/mysql --datadir=/usr/program/mysql/data --skip-name-resolve --user=mysql `
41
41
- 启动 Mysql 服务器:` service mysql start `
42
42
- 查看是否已经启动了:` ps aux | grep mysql `
43
43
- 常用命令软连接,才可以在终端直接使用:mysql 和 mysqladmin 命令
44
44
- ` sudo ln -s /usr/program/mysql/bin/mysql /usr/bin `
45
45
- ` sudo ln -s /usr/program/mysql/bin/mysqladmin /usr/bin `
46
46
47
47
48
+ ## 修改 root 账号密码
49
+
50
+ - 默认安装情况下,root 的密码是空,所以为了方便我们可以设置一个密码,假设我设置为:123456
51
+ - 终端下执行:` mysql -uroot `
52
+ - 现在进入了 mysql 命令行管理界面,输入:` SET PASSWORD = PASSWORD('123456'); `
53
+
54
+
55
+
48
56
## MySQL 主从复制
49
57
50
58
- 假设有两台服务器,一台做主,一台做从
Original file line number Diff line number Diff line change 101
101
102
102
## 差异
103
103
104
- - 我们现在增加系统变量在:/etc/profile 后,输入命令:source /etc/profile 之后,重启服务器发现还是需要再 source 一次。Google 很多办法发现都没效果。
104
+ - 我们现在增加系统变量在:/etc/profile 后,输入命令:source /etc/profile 之后,重启服务器发现刚刚的系统变量现在没效果。
105
+ - 解决办法:` vim ~/.zshrc ` ,在该配置文件里面增加一行:` source /etc/profile ` ,然后刷新 zsh 的配置:` source ~/.zshrc ` 。
105
106
106
107
107
108
## 资料
You can’t perform that action at this time.
0 commit comments