1. ### MySQL 5.7.28 Community Server Centos7
[lake@localhost opt]$ netstat -an --tcp |grep 3306
tcp6 0 0 :::3306 :::* LISTEN
[lake@localhost opt]$ systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-06-11 09:42:28 CST; 1h 32min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 9030 (mysqld)
CGroup: /system.slice/mysqld.service
└─9030 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
Jun 11 09:42:29 localhost.localdomain mysqld[9030]: 2020-06-11T01:42:29.194736Z 0 [Note] /usr/l...s.
Jun 11 09:42:29 localhost.localdomain mysqld[9030]: Version: '5.7.28' socket: '/tmp/mysql.sock...L)
Jun 11 09:42:48 localhost.localdomain mysqld[9030]: 2020-06-11T01:42:48.523547Z 2 [Note] Access...S)
Jun 11 09:43:42 localhost.localdomain mysqld[9030]: 2020-06-11T01:43:42.104118Z 3 [Note] Access...S)
Jun 11 09:57:06 localhost.localdomain mysqld[9030]: 2020-06-11T01:57:06.800131Z 7 [Warning] IP ...wn
Jun 11 09:57:09 localhost.localdomain mysqld[9030]: 2020-06-11T01:57:09.490904Z 7 [Note] Aborte...s)
Jun 11 10:08:03 localhost.localdomain mysqld[9030]: 2020-06-11T02:08:03.207293Z 8 [Note] Got pa...er
Jun 11 11:13:30 localhost.localdomain mysqld[9030]: 2020-06-11T03:13:30.651913Z 9 [Note] Access...O)
Jun 11 11:13:36 localhost.localdomain mysqld[9030]: 2020-06-11T03:13:36.239369Z 10 [Note] Acces...O)
Jun 11 11:13:42 localhost.localdomain mysqld[9030]: 2020-06-11T03:13:42.416869Z 11 [Note] Acces...O)
Hint: Some lines were ellipsized, use -l to show in full.
[lake@localhost opt]$ cat /etc/my.cnf
#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
## Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
## Settings user and group are ignored when systemd is used.
## If you need to run mysqld under a different user or group,
## customize your systemd unit file for mariadb according to the
## instructions in http://fedoraproject.org/wiki/Systemd
#
#[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
#
##
## include all files from the config directory
##
#!includedir /etc/my.cnf.d
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/data_mysql
server_id=6
port=3306
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
[lake@localhost opt]$ mysql
ERROR 1045 (28000): Access denied for user 'lake'@'localhost' (using password: NO)
[lake@localhost opt]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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> 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
mysql>
mysql> select user,authentication_string from user ;
+---------------+-------------------------------------------+
| user | authentication_string |
+---------------+-------------------------------------------+
| root | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| root | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 |
+---------------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql>
################
Change root/mysql password
[lake@localhost opt]$ mysql -u root -p
Enter password:
mysql> use mysql //选择mysql数据库
mysql> update user set Password = password('123456') where User = 'root';
//更新root密码,password()是一个将密码进行加密的方法,'123456'是更改后的root密码。
mysql> quit
Bye
2. Create git user system
[lake@DESKTOP-P55Q2H7 ~]$ sudo adduser git
[sudo] password for lake:
[lake@DESKTOP-P55Q2H7 ~]$ sudo passwd git
Changing password for user git.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[lake@DESKTOP-P55Q2H7 ~]$ su - git
Password:
[git@DESKTOP-P55Q2H7 ~]$ cd ..
3. gogs_0.11.91_linux_amd64.tar.gz/web install
[git@DESKTOP-P55Q2H7 ~]$ ls -l
total 25092
-rw-rw-r--. 1 lake lake 25690601 Jun 15 10:36 gogs_0.11.91_linux_amd64.tar.gz
[git@DESKTOP-P55Q2H7 ~]$ tar zxf gogs_0.11.91_linux_amd64.tar.gz
[git@DESKTOP-P55Q2H7 ~]$ ls
gogs gogs_0.11.91_linux_amd64.tar.gz
[git@DESKTOP-P55Q2H7 ~]$ cd gogs/
[git@DESKTOP-P55Q2H7 gogs]$ ls
gogs LICENSE public README.md README_ZH.md scripts templates
[git@DESKTOP-P55Q2H7 gogs]$ ./gogs --version
Gogs version 0.11.91.0811
[git@DESKTOP-P55Q2H7 gogs]$
4. ############# Create gogs Database in Mysql DB
[git@DESKTOP-P55Q2H7 gogs]$ mysql -u root -p <scripts/mysql.sql
Enter password:
[git@DESKTOP-P55Q2H7 gogs]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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> 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
mysql> create user 'gogs@localhost' identified by '123456' ;
Query OK, 0 rows affected (0.01 sec)
Note gogs@localhost and gogs are different users in Mysql/user table
mysql> grant all privileges on gogs.* to 'gogs@localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
### Test
[git@DESKTOP-P55Q2H7 gogs]$ mysql -u gogs@localhost -p
Enter password:123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.7.28 MySQL Community Server (GPL)
5. web install gogs
[git@DESKTOP-P55Q2H7 gogs]$ netstat -an --tcp |grep 3000
[git@DESKTOP-P55Q2H7 gogs]$ ./gogs web
2020/06/15 10:40:50 [ WARN] Custom config '/home/git/gogs/custom/conf/app.ini' not found, ignore this if you're running first time
2020/06/15 10:40:50 [TRACE] Custom path: /home/git/gogs/custom
2020/06/15 10:40:50 [TRACE] Log path: /home/git/gogs/log
2020/06/15 10:40:50 [TRACE] Log Mode: Console (Trace)
2020/06/15 10:40:50 [ INFO] Gogs 0.11.91.0811
2020/06/15 10:40:50 [ INFO] Cache Service Enabled
2020/06/15 10:40:50 [ INFO] Session Service Enabled
2020/06/15 10:40:50 [ INFO] SQLite3 Supported
2020/06/15 10:40:50 [ INFO] Run Mode: Development
2020/06/15 10:40:51 [ INFO] Listen: http://0.0.0.0:3000
=============> http://192.168.137.172:3000/ ====>Redirect to ===>http://192.168.137.172:3000/install
Note :
Database Settings/User: gogs@localhost ********
Application URL : http://192.168.137.172/:3000/
Admin user for gogs/respository , created in user/gogs MySQL DB
======> login
create sample http://192.168.137.172:3000/repo/create
http://localhost:3000/hushui/Sample.git
===> create in in repository/gogs MySQL DB