Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed steps for installing and configuring mysql

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following brings you detailed steps on installing and configuring mysql. If you are interested, take a look at this article. I believe that after reading the detailed steps of installing and configuring mysql, it will be somewhat helpful to everyone.

1: Install MySQL

1. Install mysql on web Cloud Virtual Machine:

yum -y remove mysql mysql-server ##Uninstall mysql rpm package

Confirm yum source specified to ftp:

[root@www ~]# cat /etc/yum.repos.d/centos.repo

[local]

name=local

baseurl=ftp://192.168.100.100/centos6

enabled=1

gpgcheck=0

yum -y install ncurses-*

lftp 192.168.100.100 ##download mysql and cmake

lftp 192.168.100.100:/tools> get cmake-2.8.6.tar.gz mysql-5.5.22.tar.gz

2. Unzip cmake and install the base environment

tar zxvf /root/cmake-2.8.6.tar.gz -C /usr/src/

cd /usr/src/cmake-2.8.6

3. configure, compile and install cmake

./ configure &&gmake &&gmake install

4. Unzip mysql

tar zxvf /root/mysql-5.5.22.tar.gz -C /usr/src/

cd /usr/src/mysql-5.5.22/

5. Use cmake to configure mysql

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql #Specify installation directory\

-DDEFAULT_CHARSET=utf8 #Specifies that the character set is utf8 \

-DDEFAULT_COLLATION=utf8_general_ci ##Specify character check\

-DWITH_EXTRA_CHARSETS=all ##Additional character sets supported\

-DSYSCONFDIR=/etc/ ##Specify the configuration file location

make &&make install #compile install

echo $? Check if the command was executed successfully.

ls /usr/local/mysql ##Verify installation directory

II. configure MySQL

1. copy profile

cp /usr/src/mysql-5.5.22/support-files/my-medium.cnf /etc/my.cnf

2. Add System Services

cp /usr/src/mysql-5.5.22/support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig mysqld on

3. Optimize PATH path, convenient when executing commands, single quotation marks and double quotation marks are OK

echo 'export PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile

source /etc/profile ##Execution file

4. Initialize mysql, create user, empower

userdel -r mysql ##Delete if user already exists, if not ignore

useradd -M -s /sbin/nologin mysql

chown -R mysql:mysql /usr/local/mysql

/usr/local/mysql/scripts/mysql_install_db \

--basedir=/usr/local/mysql \

--datadir=/usr/local/mysql/data --user=mysql

5. Start mysql and set it to boot

/etc/init.d/mysqld start

chkconfig mysqld on

6. change the password

mysqladmin -u root password '123123'

7. Log in to mysql:

mysql -uroot -p123123 ##Login, or you can use the-h option to specify the ip address of the Cloud Virtual Machine to log in remotely

quit

Read the above detailed steps on installing and configuring mysql, whether there is any harvest. If you want to know more about it, you can continue to pay attention to our industry information section.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report