Fedora安装Mysql+phpMyAdmin+Php

1、安装mysql

dnf install https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm
dnf install mysql-community-server

启动

systemctl start mysqld.service ## use restart after update
systemctl enable mysqld.service
grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1

Example Output:

2018-09-20T12:34:08.692952Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: w+OlrJSc,9d-

/usr/bin/mysql_secure_installation

输入上面产生的临时密码
Output:

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: 

Re-enter new password: 

Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

注意上面的密码规则,如特殊字符+大小写+数字
进入Mysql

mysql -u root -p

Create Database, Create MySQL User and Enable Remote Connections to MySQL Database
This example uses following parameters:

DB_NAME = webdb
USER_NAME = webdb_user
REMOTE_IP = 10.0.15.25
PASSWORD = password123
PERMISSIONS = ALL

## CREATE DATABASE ##
mysql> CREATE DATABASE webdb;

## CREATE USER ##
mysql> CREATE USER 'webdb_user'@'10.0.15.25' IDENTIFIED BY '(PASSword123)';

## GRANT PERMISSIONS ##
mysql> GRANT ALL ON webdb.* TO 'webdb_user'@'10.0.15.25';

##  FLUSH PRIVILEGES, Tell the server to reload the grant tables  ##
mysql> FLUSH PRIVILEGES;

2 安装php

 dnf install php
 
 dnf install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

vim test.php

<?php
phpinfo();
?>

http://localhost/test.php

3 安装phpMyAdmin

 dnf install phpMyAdmin

编辑vim /etc/nginx/nginx.conf

vim  /etc/nginx/nginx.conf

 location /phpMyAdmin {                  
      alias /usr/share/phpMyAdmin/;                       #后面的"/"符号一定要带上
     }

systemctl restart nginx.service   #重启

http://127.0.0.1/phpMyAdmin/

猜你喜欢

转载自blog.csdn.net/gumufuyun/article/details/82793668