mysql-5.7.28-el7-x86_64.tar.gz安装示例

1、安装环境:
Redhat—6.5
mysql-5.7.28-el7-x86_64.tar.gz

1.1安装依赖包,挂载光盘
mount /dev/sr0 /mnt/
cd /mnt/Packages/

安装glibc
rpm -ivh glibc-2.17-260.el7.x86_64.rpm --force --nodeps
rpm -ivh glibc-devel-2.17-260.el7.x86_64.rpm --nodeps --force
否则报错:/lib64/libc.so.6: version `GLIBC_2.17' not found
安装glibc++
rpm -ivh libstdc++-4.8.5-36.el7.x86_64.rpm --nodeps --force
rpm -ivh libstdc++-devel-4.8.5-36.el7.x86_64.rpm --nodeps --force
否则报错:/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found

查看文件版本:strings /usr/lib64/libstdc++.so.6|grep GLIBCXX

1.2安装步骤
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir -p /mydata/mysql_57_data
shell> chown -R mysql:mysql /mydata/mysql_57_data
shell> chmod -R 750 /mydata/mysql_57_data

shell> vi /etc/my.cnf
内容如下:

[mysqld]
port=3306
user=mysql
datadir=/mydata/mysql_57_data
log_error=error.log

shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> /etc/init.d/mysql.server start 正常启动MySQL
shell> bin/mysqld_safe --user=mysql & 安全模式启动MySQL

1.3 添加环境变量:
shell> vi ~/.bash_profile 添加一下内容:
export PATH=$PATH:/usr/local/mysql/bin
shell> . ~/.bash_profile

1.4 添加mysql自启动服务:
[root@yxxt01 mysql]# chkconfig --add mysql.server
[root@yxxt01 mysql]# chkconfig --list mysql.server

1.5 mysql登录问题
#mysql -uroot -p
登录报错:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
该错误是找不到mysql.sock --MySQL服务启动后自动生成该文件
#mysql -uroot -p -S /tmp/mysql.sock

报错:ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
该提示密码过期
vi /etc/my.cnf
[mysqld]添加内容如:skip-grant-tables
重启MySQL服务
重新登录MySQL
查询root用户配置信息:select * from mysql.user where user=‘root’ \G
把password_expired 改成不过期

update user set password_expired=‘N’ where user=‘root’;
update mysql.user set authentication_string=password(‘zhougy’) where user=‘root’;
flush privileges;
quit

1.6 MySQL相关设置 my.cnf
1.6.1 指定sock路径
[client]
socket=/tmp/mysql.sock
[mysqld]
socket=/tmp/mysql.sock

1.6.2 mysql免密操作
[client]
user=root
password=xxx
socket=/tmp/mysql.sock

16.3 显示当前登录数据库
[mysql]
prompt=(\u@\h) [\d]>\_

你可能感兴趣的:(Oracle数据库)