yum -y remove mariadb
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
yum -y install mysql80-community-release-el8-1.noarch.rpm
vim /etc/yum.repos.d/mysql-community.repo
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/8/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
yum -y install mysql-community-server
systemctl start mysqld
cat /var/log/mysqld.log | grep password
mysql -uroot -p
alter user 'root'@'localhost' identified by '123456';
vim /etc/my.cnf
skip-grant-tables
systemctl restart mysqld
mysql -uroot -p
update mysql.user set authentication_string=password('123456') where user= 'root';
exit
systemctl restart mysqld
mysql -uroot -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'zss'@'localhost' IDENTIFIED BY 'zss@!123S' WITH GRANT OPTION;
flush privileges;
刷新权限
8.0之后 些微不一样
GRANT 授予
ALL PRIVILEGES 所有的权限
*.* 所有数据库的所有表
'zss'@'localhost' 允许本机登陆
IDENTIFIED BY 'zss@!123S' 设置密码
WITH GRANT OPTION 权限可以往下传递
mysql -uzss -p
alter
update
show grants;
revoke
drop
mysql> GRANT ALL PRIVILEGES ON *.* TO 'zsss'@'%' IDENTIFIED BY 'zsss@!1234S' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql -uzsss -h192.168.0.1 -p
vim /etc/my.cnf
bind-address=127.0.0.1
mysql> create database zss charset=utf8;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| zss |
+--------------------+
5 rows in set (0.01 sec)
mysql>
mysql> use zss;
Database changed
mysql> create table student(id int primary key auto_increment comment "用户的唯一标识",name varchar(128),age int)charset=utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> show tables;
+---------------+
| Tables_in_zss |
+---------------+
| student |
+---------------+
1 row in set (0.00 sec)
mysql> create table teacher(id int primary key auto_increment comment "用户的唯一标识",name varchar(128),age int,height float)charset=utf8;
Query OK, 0 rows affected (0.00 sec)
desc student;
sescribe <tablename>
show create table student;
alter table <tablename> rename <newname>
alter table xuesheng rename to test.student;
alter table <tablename> rename to <newdbname.newtablename>
alter table student add score float;
alter table student add xxx int first;
alter table student add tell int after age;
alter table student modify tell varchar(12) unique;
alter table student change tell ppp varchar(12) unique;
alter table student drop xxx;
drop table student;
drop database zss;
alter databse <dbname> charset=utf8;
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
pip3 install mycli
pip install --ignore-installed mycli
yum -y install gcc libffi-devel python-devel openssl-devel && pip install mycli==1.8.1
pip install pymysql==0.9.2
mycli -uroot
ok
报错参考
https://blog.csdn.net/querydata_boke/article/details/106079018
https://blog.csdn.net/qq_33392383/article/details/107594747
转载请注明原文地址:https://blackberry.8miu.com/read-32693.html