Install mysql in Linux and mysql in Linux
I. Simple Installation
# Yum install-y mysql-server mysql-devel
If an installation package conflict is reported:
File/usr/share/mysql/ukrainian/errmsg. sys from install of MySQL-server-5.5.18-1.rhel5.i386 conflicts with file from package mysql-libs-5.0.46-1.rhel5.i386
Uninstall the installation package.
# Yum-y remove mysql-libs-5.0.46-1.rhel5.i386-y means you don't have to ask whether to remove
After uninstallation, MySQL is successfully installed.
Ii. Manual Installation
1. First upload the installation package
/Opt/MySQL-server-4.0.16-0.i386.rpm/opt/MySQL-client-4.0.16-0.i386.rpm (depending on the situation, not necessarily installed)
2. Add execution permissions to files
# Switch cd/opt/to the specified directory
# Chmod a + x MySQL-server-4.0.16-0.i386.rpm adds execution permissions to the file
3. Install
# Rpm-ivh MySQL-server-4.0.16-0.i386.rpm
If the installation process reports the following error: file/usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.5.24-1.el6.i686 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686file/usr/share/mysql/czech/errmsg. sys from install of MySQL-server-5.5.24-1.el6.i686 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686
The cause is a package conflict! Some packages in the operating system conflict with mysql packages. First, remove the conflicting libs packages and install them.
# Yum-y remove mysql-libs-5.1.52 *-y means you don't have to ask whether to remove
If the following error is reported after the uninstallation is completed:
Error: Failed dependencies: libc. so.6 is needed by MySQL-server-community-5.1.63-1.rhel4.i386 libc. so.6 (GLIBC_2.0) is needed by MySQL-server-community-5.1.63-1.rhel4.i386 libc. so.6 (GLIBC_2.1) is needed by MySQL-server-community-5.1.63-1.rhel4.i386
If the package is missing, install the package as follows:
# Yum install libc. so.6
Run the following command again to install MySQL:
# Rpm-ivh MySQL-server-4.0.16-0.i386.rpm
3. Set the root password
For newly installed mysql, the User root does not have a password by default. You need to set a password.
#/Usr/bin/mysqladmin-u root-p '000000'
If an error is reported, mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user 'root' @ 'localhost' (using password: YES) 'is displayed )'
Solution:
First shut down the database # service mysqld stop
Start it without security check # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
Log on to # mysql-u root mysql
Change the Password # UPDATE user set password = Password ('newpassword') where USER = 'root' and host = 'root' or host = 'localhost'; # flush privileges;
Restart mysql # service mysqld restart or # ps-aux | grep mysqld command to find the mysql process number, and then run kill-9 to kill the mysql process.
4. Authorize remote user logon
For newly installed mysql, only the local computer can log on by default, and other computers need to be authorized to log on through the network.
Log on first #/usr/bin/mysql-uroot-p
Re-authorize # grant all on *. * to root @ '%' identified by '000000'; # flush privileges;
Now, mysql can be used.
5. pitfalls
Once I installed MYSQL on a machine, everything was normal after it was installed. I could log on to the server using the command line, but there was no mysql library. I tried various methods and reinstalled it multiple times, all failed. The temporary solution is to import a mysql database to another normal database and create it manually. The database can be used normally. After a month of observation, there is no problem. I don't know why the mysql database is not created yet.