MySQL installation configuration and precautions under Linux

Source: Internet
Author: User
Tags localhost mysql win32 administrator password mysql command line firewall

Download the MySQL installation file

The following two files are required to install MySQL:

mysql-server-4.0.16-0.i386.rpm
mysql-client-4.0.16-0.i386.rpm

Download Address: http://www.mysql.com/downloads/mysql-4.0.html, open this page, Drop-down page to find "Linux x86 RPM Downloads" item, find "Server" and "Client Programs "Item, download the required two RPM files.

The rpm file is a software installation package developed by Red Hat, which allows Linux to remove many complex procedures when installing software packages. The commonly used parameter for this command at installation is –IVH, where I indicates that the specified RMP package will be installed, V represents details of the installation, and H indicates that the "#" symbol appears during installation to display the current installation process. This symbol will continue until the installation is complete before stopping.

Install Server Side

Run the following command in a directory with two RMP files:
[Root@test1 local]# RPM-IVH mysql-server-4.0.16-0.i386.rpm
Displays the following information.
Warning:mysql-server-4.0.16-0.i386.rpm:v3 DSA Signature:nokey, key ID 5072e1f5
Preparing ... ########################################### [100%]
1:mysql-server ########################################### [100%]
。。。。。。 (Omitted display)
/usr/bin/mysqladmin-u root password ' new-password '
/usr/bin/mysqladmin-u root-h test1 password ' new-password '
。。。。。。 (Omitted display)
Starting mysqld daemon with databases From/var/lib/mysql

If appear as above information, the service side installs completes. Test whether the success can be run netstat see whether the MySQL port is turned on, such as open means that the service has been started, the installation was successful. The default port for MySQL is 3306.
[Root@test1 local]# Netstat-nat
Active Internet connections (servers and established)
Proto recv-q send-q Local address Foreign
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
The above shows that the MySQL service has been started.

Install Client

Run the following command:
[Root@test1 local]# RPM-IVH mysql-client-4.0.16-0.i386.rpm
Displays the following information
Warning:mysql-client-4.0.16-0.i386.rpm:v3 DSA Signature:nokey, key ID 5072e1f5
Preparing ... ########################################### [100%]
1:mysql-client ########################################### [100%]
Show installation complete.

Installation considerations, five reasons for installation failure

Error 1:wizard installation Last page, cannot create Windows service for mysql.error:0 Error

WORKAROUND: Open the command line to enter SC delete mysql command that
C:>SC Delete MySQL
[SC] DeleteService SUCCESS
Reboot the computer, or reboot and install after unloading, which is fine. I was restarted after the uninstall.

Uninstall reinstall to notice a problem, in the Control Panel uninstall, to the C:\Documents and Settings\All Users\Application Data directory to delete the MySQL folder. It may record the configuration information you uninstalled, which will affect the next installation.

Error 2: There is a line of current password in addition to password and Confirm password when the input administrator enters the password.

This means that you did not put the MySQL folder in the directory that I mentioned in article 1th before you installed it. Do not know whether to affect the subsequent use, may remember the password does not matter. In addition, the administrator password is set by itself, and the user name is the default root.

After successful installation, you can test the following: Open the MySQL command line client, enter the password, appear
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3
Server version:5.1.33-community MySQL Community Server (GPL)
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the buffer.
Mysql>
The installation is successful!

Error 3:mysql server configuration failed.

Viewing the error message in the Configuration Wizard has the following statement:
mysql-server-5.5-win32:60-adding firewall rule for MySQL55 on port 3306.
mysql-server-5.5-win32:66-adding firewall rule failed.

Indicates that the firewall installation failed.

View the installation log to find the following statement:
Mysql-installer information:10:attempting to create firewall rule with Command:netsh.exe Firewall add portopening Pro Tocol=tcp port=3306 profile=all name=mysql55 mode=enable scope=all
Mysql-installer information:10:unexpected response from netsh: ok.
Mysql-installer information:10:attempting to create firewall rule with Command:netsh.exe advfirewall Firewall add Rul E name= "Port 3306" protocol=tcp localport=3306 dir=in Action=allow
Mysql-installer information:10:unexpected response from Netsh: The following command was not found: Advfirewall firewall add Rule name= "Port 3306" Protocol=tcp localport=3306 dir=in Action=allow.

This situation indicates that the MySQL installation is not good for Chinese system, does not recognize the "OK" information returned by Netsh.exe, and then runs the Netsh.exe advfirewall command that can run on other Windows platforms (this command XP does not support Therefore, the report could not find the error of the command.

There are two solutions:
① set the language of your operating system to English, and then reinstall MySQL. Specific can be entered into the Control Panel-> region and language to change; In addition, check that the current user has permission to start the firewall, view the properties of the application Layer Gateway service in the computer service, and see if the user in the Login tab is the current user.
② Check the firewall port, if it has been added successfully, do not process, if not successfully added, you manually add a port in the firewall.

Error 4: After the installation is successful, you can only connect to localhost MySQL server via the MySQL 5.5 command line client and not remotely via workbench or other client tools.

Possible causes:

① does not have a beginning port, see the previous one to solve.
The ② user does not authorize remote connections.
③mysql server does not allow remote connections.

For ② users who do not authorize remote connections, you can authorize users, such as the default root user, to enter the following command in the MySQL 5.5 command line client:
Select Database
Mysql>use MySQL;
Give user authorization, YourPassword field with your password instead
Mysql>grant all priileges in *.* to identified by ' YourPassword ';
Refresh System Permission Table
Mysql>flush privileges;

See if authorization is successful
Mysql> show grants for roots;

If a new authorization appears, it indicates success. If not successful, add a new user to try, add the user's command:
Insert into Mysql.user (host,user,password,ssl_cipher,x509_issuer,x509_subject) VALUES ("%", "NewUser", Password (" NewPassword "), ', ', ', '

A workaround for ③mysql server that does not allow remote connections is to find its own my.ini and add a single line of statements under [MYSQLD]:
bind-address=0.0.0.0
Indicates that you are not binding IP, restart your MySQL service.


Error 5: Location of configuration file My.ini

The MySQL Configuration Wizard places the My.ini file in the MySQL server installation directory. This will help you associate a configuration file with a specific server instance. To ensure that the MySQL server knows where to look for My.ini files, parameters similar to the following will be passed to the MySQL server as part of the installation of the service:--defaults-file= "C:\Program files\mysql\mysql Server 5.5\my.ini C:\Program files\mysql\mysql Server 5.5 can be replaced by an installation path that points to the MySQL server.

Edit My.ini: You can use a text editor to open the file and make the necessary edits and modifications. You can also modify the server configuration with the MySQL administrator application. MySQL clients and applications, such as the MySQL command line client and mysqldump, do not determine the location of the My.ini file located in the server installation directory. To configure the client and the application, generate a new file My.ini file under C:\Windows or C:\WINNT directory, depending on your version of Windows

If your MySQL Configuration Wizard discovers an existing My.ini file, you can reconfigure the existing server, or remove the server instance by removing the My.ini file, stopping and removing the MySQL service. Reconfigure a server that already exists, select the "Reconfigure instance" option and select the Next button. An existing My.ini file is renamed to Mytimestamp.ini.bak, and the timestamp is the date and time that the My.ini was created. Removes an existing database instance, selects the Remove instance option and selects the Next button. If you select the Remove instance option, go to the confirmation interface. Click the Run button: the MySQL Configuration Wizard stops and starts to remove the MySQL service and deletes the My.ini file. However, the server installation directory is not removed. If you select the "Reconfigure instance" option to enter the configuration type interface, you can choose to install the type of installation you want to configure.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.