标签:内容 获取 oracle pass amp lte 账号 data databases
为mysql创建用户组
[root@linux01 ~]# groupadd mysql
添加mysql用户
[root@linux01 ~]# useradd -r -g mysql mysql
创建目录
[root@linux01 ~]# mkdir -p /kingsql/database/mysql/tmp/
[root@linux01 ~]# mkdir -p /kingsql/database/mysql/log/
创建mysqld.log日志
[root@linux01 ~]# touch /kingsql/database/mysql/log/mysqld.log
将安装包移动到mysql目录下
[root@linux01 ~]# mv mysql8.0_kingsql.tar.gz /kingsql/database/mysql/
[root@linux01 ~]# cd /kingsql/database/mysql/
修改目录所属用户
[root@ogg02 ~]# chown mysql:mysql -R /kingsql
解压安装包
[root@linux01 mysql]# tar -zxvf mysql8.0_kingsql.tar.gz
bin/
bin/mysqlxtest
bin/mysql_tzinfo_to_sql
…………………………
执行安装指令,安装结束后会给出一个初始密码
[root@linux01 mysql]# /kingsql/database/mysql/bin/mysqld --initialize --user=mysql --datadir=/kingsql/database/mysql/data --basedir=/kingsql/database/mysql
修改my.cnf,添加以下内容
[root@ogg02 etc]# vi /etc/my.cnf
[client]
socket = /kingsql/database/mysql/tmp/mysql.sock
[mysqld_safe]
log-error=/kingsql/database/mysql/log/mysqld.log
pid-file=/kingsql/database/mysql/mysqld.pid
[mysqld]
basedir = /kingsql/database/mysql
datadir = /kingsql/database/mysql/data
port = 3306
socket = /kingsql/database/mysql/tmp/mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
将环境变量修改写入/etc/profile
[root@ogg02 etc]# echo "export PATH=$PATH:/kingsql/database/mysql/bin" >> /etc/profile
刷新/etc/profile
[root@ogg02 etc]# source /etc/profile
mysqld_safe脚本启动MySQL服务器后继续监控其运行情况
[root@ogg02 ~]# mysqld_safe&
[1] 2989
[root@ogg02 ~]# 2018-02-05T05:24:40.919162Z mysqld_safe Logging to ‘/kingsql/database/mysql/log/mysqld.log‘.
2018-02-05T05:24:40.948708Z mysqld_safe Starting mysqld daemon with databases from /kingsql/database/mysql/data
# 获取临时密码 grep ‘temporary password‘ /var/log/mysqld.log
# 使用临时密码登录 mysql -u root -p
登录Mysql,密码为刚刚的初始密码
[root@ogg02 ~]# mysql -u root -p
Enter password:
# 修改root账户的密码
mysql> alter user ‘root‘@‘localhost‘ identified by ‘oracle‘;
Query OK, 0 rows affected (0.16 sec)
使用Mysql数据库
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
默认的账号的host属性都是localhost,意思是这个账号只能本地使用,如果要使用某个账号来远程登录,必须将账号的host属性值更改成%。
mysql> update user set host=‘%‘;
Query OK, 4 rows affected (0.11 sec)
Rows matched: 4 Changed: 4 Warnings: 0
刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> GRANT ALL ON *.* TO ‘root‘@‘%‘; # *.*代表所有表的所有字段
Query OK, 0 rows affected (0.11 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
mysql>
修改密码认证方式为mysql_native_password
mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY ‘oracle‘;
Query OK, 0 rows affected (0.11 sec)
mysql>
刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
标签:内容 获取 oracle pass amp lte 账号 data databases
原文地址:https://www.cnblogs.com/kawashibara/p/9315939.html