In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to build the Mysql and PHP environment in the Lamp environment. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Lamp environment building
-the construction of Mysql and PHP environment
Part one: enough disk space
In the early stage, we used snapshots to build a virtual machine with only 8 GB of disk space, while Mysql needs at least 20 GB of disk space, so we need to expand the disk capacity first.
# disk expansion:
Partition > > pvcreate > > vgextend > > lvextend
Add a 20g virtual disk / dev/vdb and use all the space as expansion space:
# Division:
# extending logical volumes
# # use lvs and vgs to view after expansion. Both are extended, but look at them with df-h, but no, you need to refresh them, and then you can see that they are really extended:
Part II: source code compilation and installation of Mysql
# obtain the installation package of MySQL and decompress:
# View the main configuration file of MySQL:
# here we use cmake to compile:
# so let's install cmake first:
# errors will occur when copying and pasting the text in the document, such as "-" will become "-", so ask you to copy the text in the document into a clean "\ vi":
# to facilitate memory management, we install mysql in the same directory as nginx:
# will report an error because we use a higher version of mysql and need a higher version of cmake, so we get the above version of cmake from computers with cmake:
# # because we have already installed a lower version of cmake, we only need to update it here:
# # cmake in the decompressed directory:
# # error will be reported:
# # need to add a sentence:
# # still report an error:
# # this is because you need to install:
# # cmake again:
# # it will also report an error and remind you which package to install:
# install the required packages:
# will also report an error because we have not deleted the previous cache file:
# # there will be a warning: you can ignore or install what he reminds you:
# # here we install the bison required by him, then clear the cache, cmake again, there will be no errors, and then we can make. When we have multiple cpu, we can use the number of j + numbers to specify the number of compiled cpu:
# # here, since we only have one cpu, we directly Make:
# # Make will be a long process, which may take nearly half an hour for an ordinary hard disk.
# # and then there is makeinstall, installation.
# # View the size of compilation and installation:
# # the compilation process takes up 6 gigabytes of space, and the installation process uses 1.9 gigabytes of space, which is why we need to expand.
Part III: MySQL initialization (specify installation directory and data storage directory):
# # when you check the ID of a MySQL user in the physical machine, you will find that it is 27:
# # View users in the system:
# We will find that there are a lot of Occupy users here (id is a system user after 1000, and 0 is a super user), including MySQL users.
# # We add a MySQL user and specify the home directory:
# # put the bin that is enabled and disabled by MySQL control into the environment variable (valid only for the current shell):
# # refresh the environment variable by source every time it is updated:
# Source and. It all means refreshing in the current directory, but sh is a new shell.
# # View the absolute path of starting and shutting down a service:
# # you can view the data storage directory of MySQL in MySQL.server:
# # put the main configuration file of the installed MySQL into the main configuration file of the system default MySQL, and put the server into the startup directory
# # change user group and user master:
# use help to view what needs to be installed for initialization:
# # then start to specify the installation directory and data storage directory of the database:
# # the system reminds mysql_install_db that it has been abandoned and asks you to try mysqld-initialize. At this time, we will check whether a data storage directory has been generated:
# # it does generate. If we keep going, there may be errors. Let's keep going:
# # before we changed the user master and user group of the files under the database to mysql, it is true that the permission is too large. As long as the MySQL user has all the permissions to the data directory, we only need read and execute permissions for others, so we need to change all the user master to root, user group to MySQL, and data user master to MySQL.
# # start the database:
# # Log in to database:
# says local users cannot log in.
# # View errors:
# # will show that it is due to security issues, that is, password issues.
# # Delete the database:
# # then delete all data in the data directory:
# # the previous errors are all due to the use of abandoned commands. Now we use mysqld to initialize the database:
# # View the parameters of installation directory, data storage directory and password
# # initializing the database:
The password will be generated on the last line:
# # opening the database
# # Log in to database:
# then the database will remind you to change the database password.
# and then remind you that the database service will read a specific file, so we need to put the password in this file:
# # generate password again:
# # if we choose to generate a relatively simple password and log in again, he will warn us to reset the password because the password we generated earlier is too simple and needs to be a little more complicated.
# # the password for the database must be a combination of uppercase letters, lowercase letters, numbers, and special characters greater than eight digits:
Part IV: compile and install PHP:
# # download PHP can be downloaded from www.php.com. Here, we directly use the good package to install:
# # copy the relevant content in the document to a pure vi:
# # then copy it. Of course, you need to use the following command to check the parameters about MySQL in PHP:
# # Editing the default PHP release file on a real machine:
# # and then visit, you will find the following:
# there are many parameters.
# # after adding all the parameters, you can proceed to the first step, and you will be waiting for a lot of errors:
# # first error and troubleshooting:
# # second error and troubleshooting:
# # third error and troubleshooting attempt:
# # failed to make two mistakes
# # so start to query, and then install
# # fourth error and troubleshooting:
# # Fifth error and troubleshooting:
# # sixth error and troubleshooting:
# # 7th error and troubleshooting attempt:
# # shows that there is no package, so we need to download the package. It is recommended to download it from the pkgs.org website:
# # here we use the downloaded package:
# # installation:
# # eighth error and troubleshooting:
# # all errors have been solved this time:
# # then you can compile:
# # install after compilation is completed.
At this point, the source code installation of PHP is completed.
After reading the above, do you have any further understanding of how to build Mysql and PHP environments in Lamp environment? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.