LNMP environment setup-MySQL
The world's most popular open source database
1. Install MySQL
root@kallen:~# apt-get install mysql-server-5.5 mysql-client-5.5
2.Add Users
(1) Select a data table
Statement: use mysql;
(2) Add a connection user account in the mysql user table:
Here, do not directly use the INSERT statement to add user records. An error may occur when using INSERT:
ERROR 1364 (HY000): Field ‘ssl_cipher’ doesn’t have a default value
However, this error did not occur in earlier MYSQL versions, because the user table has been directly modified or the INSERT statement has been directly used. When MYSQL is upgraded to MYSQL 5.1, this error may occur.
We recommend that you use the GRANT statement for authorization. The statement is as follows:
GRANT USAGE ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Last sentence:
Replace "username" with the user name to be authorized, such as clientusr;
Replace "password" with the password set by clientusr;
(3) Data Table Access Authorization
After the account is created, authorize the preceding common user to the data table. The default permissions of the connected user added in step 3 are "N" and must be authorized for the account in the db table, allow the user to access the dedicated database. Of course, the super user will not talk about it.
Use the following statement:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON tablename.* TO 'username'@'localhost' IDENTIFIED BY 'password';
The permissions in this statement are determined based on actual needs:
Replace "tablename" with the table name of the authorized data table
"Username" is the username authorized in step 2.
"Password" is the password set for Step 2 Authorized Users
This grants the SELECT, INSERT, UPDATE, DELETE, CAREATE, and DROP permissions to a data table.
(4) effective authorization, created
One sentence: flush privileges;
3.Install phpmyadmin
Download and install phpmyadmin on any web server that supports PHP (such as Apache, Nginx, and Lighttpd.
Sudo apt-get install phpmyadmin # note that this is installed in/usr/share/phpmyadmin
In ubuntu, sudo apt-getinstall phpmyadmin has some settings, such as server selection and password setting. After the installation is complete, the 404 error occurs when you access http: // localhost/phpmyadmin. This is because the phpmyadmin directory is not mapped to the apache directory. Run the following command:
sudo ln -s /usr/share/phpmyadmin /var/www/html
[Common Errors]
(1) installation error:
Error: Package: php54w-tidy-5.4.41-1.w6.x86_64 (webtatic) Requires: libtidy-0.99.so.0()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
Need to install libtidy-0.99.so:
[root@amtt02 html]# rpm -ivh libtidy-0.99.0-19.20070615.1.el6.x86_64.rpm
(2) Access Error:
Add the following to the http. conf file:
AllowOverride None Order allow,deny Allow from all
service httpd restart
Then, the httpd service can be started successfully and the problem is solved.
Prompt for accessing phpMyAdmin:
The Configuration File Permission is incorrect and cannot be written!
Solution:
chmod -R 755 ./phpmyadmin
In this way, the phpMyAdmin directory permission attribute is set to 755. It turns out that phpMyAdmin can run only with the 755 permission.
Note: It is also incorrect in 777. It is estimated that phpMyAdmim is safe.
4.Can’t connect to MySQL server on ‘localhost’(10038)
Check whether remote connection is allowed in your MYSQL user table.
(1) authorize the user
mysql>grant all privileges on *.*to'root'@'%' identified by 'youpassword' with grant option;
mysql>flush privileges;
(2) Modify/etc/mysql/my. conf
Find bind-address = 127.0.0.1.
Change bind-address = 0.0.0.0.
root@kallen:/etc/selinux# vim /etc/mysql/# Instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.# bind-address = 127.0.0.1# Remote Access to MySQL on port 3306# Kallen Ding, Jun 11 2015bind-address = 0.0.0.0
【Note] The referenced image is fromMySQL Official Website.
Hot recommendations
LNMP environment setup-Nginx
Configure the local YUM source in RHEL6.5
Installing and using Zabbix in Ubuntu
Troubleshooting of MySQL dual-master hot standby
Rsync synchronization error handling Fix Elementary Boot Screen (plymouth UTH)
After Installing Nvidia Drivers LNMP environment setup -- MySQL Shell Step by Step (3) -- Stdin & if Shell Step by Step (4) -- Cron & Echo