1. 程式人生 > 其它 >C# 物件和byte陣列的互相轉化(序列化)

C# 物件和byte陣列的互相轉化(序列化)

1、mysql 5.7下載連結

2、上傳到伺服器並解壓

[root@xiaobing software]# ls
jdk1.8  mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
//解壓
[root@xiaobing software]# tar -zxvf mysql-5.7.34-linux-glibc2.12-x86_64.tar.gz
//重新命名
[root@xiaobing software]# mv mysql-5.7.34-linux-glibc2.12-x86_64 mysql

3、建立mysql使用者組和使用者並修改許可權

[root@xiaobing mysql]# groupadd mysql
[root@xiaobing mysql]# useradd 
-r -g mysql mysql

4、建立資料目錄並賦予許可權

[root@xiaobing software]# mkdir -p  /data/mysql
[root@xiaobing software]# chown mysql:mysql -R /data/mysql
[root@xiaobing data]# ll
total 0
drwxr-xr-x 2 mysql mysql 6 Jan 6 20:28 mysql

5、配置my.cnf

vim /etc/my.cnf  //內容如下:
[root@xiaobing etc]# ls | find 'my.cnf'
my.cnf
[root@xiaobing etc]# cat my.cnf 
[mysqld]
bind
-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/software/mysql //敲黑板 datadir=/data/mysql //敲黑板 socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid #character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true [root@xiaobing etc]#

6、初始化資料庫

//進入mysql的bin目錄
cd /usr/local/software/mysql/bin
//初始化
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize
//檢視密碼
[root@xiaobing bin]# cat /data/mysql/mysql.err

7、啟動mysql,並更改root 密碼,先將mysql.server放置到/etc/init.d/mysql中

[root@xiaobing support-files]# cp /usr/local/software/mysql/support-files/mysql.server /etc/init.d/mysql

8.報錯:

修改下指定路徑:

[root@xiaobing init.d]# vim mysql
basedir=/usr/local/software/mysql
datadir=/data/mysql

9、啟動mysql

[root@xiaobing init.d]# service mysql start
Starting MySQL.                                            [  OK  ]
//到這裡說明mysql已經安裝成功了!!

10、修改mysql登入密碼

 //bin目錄下執行
[root@xiaobing bin]# ./mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.34

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> 
                           

11、使用新密碼,重新登入

[root@xiaobing bin]# ./mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> 
mysql> 
mysql> 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> 

12、但是現在遠端連結還是不支援

//這裡主要執行下面三個命令(先登入資料庫)
use mysql                                            #訪問mysql庫
update user set host = '%' where user = 'root';      #使root能再任何host訪問
FLUSH PRIVILEGES;                                    #重新整理

13.到此 MySQL5.7就裝好了,親測總結,以備後續參考!