Download and install MySQL
Install with the following command
$ dnf install mysql-server
Note: Fedora is installed by default mariadb
After the installation is complete, test with the following command
$ mysql --version
Open 3306 Ports
First enter the following command to open the MySQL service
$ sudo systemctl start mariadb
Then use the following command 3306
to query the port case
$ netstat -an | grep 3306
If you do not show
tcp 0 0 127.0.0.1:3306 0.0.0.0:*
The description is open.
Otherwise, it is not open. Execute the following command:
$ sudo vim /etc/my.conf #(后面为注释不需要输入)打开my.conf
Found it
# localhost which is more compatible and is not less secure.bind-address = 127.0.0.1
Will bind-address = 127.0.0.1
be #
commented out, i.e. the two lines above become
# localhost which is more compatible and is not less secure.# bind-address = 127.0.0.1
Finally restart the MySQL service
$ sudo systemctl restart mariadb
Assigning permissions for remote logins
Log in to MySQL
$ mysql -uroot -p
Then select the database
use DATABASES_NAME
Assigning permissions:
/*root用户可以使用密码123从任何地方访问*/GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION; FLUSH PRIVILEGES; #刷新生效/*root用户可以使用密码123从192.168.1.3访问*/GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY '123' WITH GRANT OPTION;FLUSH PRIVILEGES;/*root用户可以使用密码123从192.168.1.3访问mydb数据库*/GRANT ALL PRIVILEGES ON mydb.* TO 'root'@'192.168.1.3' IDENTIFIED BY '123' WITH GRANT OPTION;FLUSH PRIVILEGES;
done!
Telnet
The instructions are as follows:
$ mysql -u 用户名 -p -h 服务器IP地址 -P 服务器端MySQL端口号 (-D 数据库名) # ()内可有可无
Fedora26 Mysql Open Remote Link service