安装mysql的整个过程
安装mysql的整个过程
1.rz –y上传到/root目录下;/root/mysql-5.5.61-linux-glibc2.12-x86_64.tar.gz
2.解压到指定目录/application;tar xf /root/mysql-5.5.61-linux-glibc2.12-x86_64.tar.gz /application
3.添加一个mysql用户;useradd -s /sbin/nologin mysql –M
4.在/application目录下更改名字为mysql-5.5.49;mv mysql-5.5.61-linux-glibc2.12-x86_64 mysql-5.5.49
5.软连接一个目录为mysql ;ln -s /application/mysql-5.5.49/ /application/mysql
6.切换目录到/mysql ;cd /application/mysql
7.在/mysql目录下安装脚本内容./scripts/mysql_install_db--basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
8.切换目录到/bin ;cd /application/mysql/bin
9.在该目录下拷贝;\cp support-files/my-small.cnf /etc/my.cnf
10.在该目录下拷贝;cp support-files/mysql.server /etc/init.d/mysqld
11.给mysqld 增加执行的权限;chmod +x /etc/init.d/mysqld
12.更改路径用替换命令;sed–i‘s#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
13.脚本启动/etc/init.d/mysqld start
14.查询脚本端口netstat -lntup|grep mysql
15.拷贝文件夹/bin/*到/usr/local/sbin/; cp -a /application/mysql/bin/* /usr/local/sbin/
16.输入mysql命令进入数据库。