20200819- Linux環境でのMySQLのインストールと環境変数の設定

1.インストールパッケージを/ optディレクトリにアップロードしますcd / opt
"/opt/MySQL-client-5.6.46-1.el7.x86_64.rpm"
"/opt/MySQL-server-5.6.46-1.el7.x86_64 .rpm "
2.依存するパッケージをインストールしますperl、new-tools、autoconf
yum install -y perl
3.競合するパッケージをアンインストールします競合するパッケージを
チェックします:
rpm -qa | grep mariadb
競合するパッケージをアンインストールします:
rpm -e mariadb-libs-5.5.60 -1.el7_5.x86_64 –nodeps
4. mysqlを
インストールして、最初にクライアントをインストールします
[root @ localhost opt]#rpm -ivh MySQL-client-5.6.46-1.el7.x86_64.rpm
次にサーバーサーバーをインストールします:rpm -ivh MySQL-server-5.6.46-1.el7.x86_64.rpm
5.
3番目の行で構成ファイルvi /usr/my.cnfを変更します:3gg + Enter a挿入状態に入り、変更が完了し、Escが挿入状態を終了します:wq save and exit
[client ]
default-character-set = utf8
[mysqld]
skip-grant-tables
character_set_server = utf8
collation_server=utf8_general_ci
6、启动mysql:
[root@localhost opt]# service mysql start
Starting MySQL. SUCCESS!
7.输入mysql进入mysql命令行
[root@localhost opt]# mysql
8.use mysql进入mysql库: use mysql
mysql> use mysql
9.修改root密码
update user set password=password(‘ok’);
quit退出
10.再次修改配置文件,把skip-grant-tables前面加上#并保存退出
[root@localhost opt]# vi /usr/my.cnf
#skip-grant-tables
11.重启mysql服务
[root@localhost opt]# service mysql restart
Shutting down MySQL… SUCCESS!
Starting MySQL. SUCCESS!

おすすめ

転載: blog.csdn.net/qq_42005540/article/details/108107396