企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
1. install MySQL online 1)download rpm for install mysql repo $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2)install mysql-community-release-el7-5.noarch.rpm $ rpm -ivh mysql-community-release-el7-5.noarch.rpm after the installation, there will be two more repos: /etc/yum.repos.d/mysql-community.repo, /etc/yum.repos.d/mysql-community-source.repo。 3)yum install mysql yum install -y mysql-community-server 4) restart mysql service。 service mysqld restart 2. set mysql password after installing mysql,root user do not have password,login mysql using: ``` $ mysql -u root ``` mysql>set password using: ``` set password for 'root'@'localhost' =password('root'); ``` no need to restart mysqld service. 3. to allow remote access: Mysql为了安全性,在默认情况下用户只允许在本地登录,可是在有此情况下,还是需要使用用户进行远程连接,因此为了使其可以远程需要进行如下操作: ``` mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION; mysql>FLUSH PRIVILEGES; ``` add port access in firewall ``` firewall-cmd --zone=public --add-port=3306/tcp --permanent ``` reload firewall ``` firewall-cmd --reload ``` 4. alter database charset(default, latin1, change it into utf8): mysql> show variables like '%character%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) 修改 /etc/my.cnf 在mysqld下加入 character-set-server=utf8 5. 默认,linux下的mysql是区分大小写的,可以通过设置修改。 修改 /etc/my.cnf 在mysqld下加入 lower_case_table_names=1 Centos7.3下安装高版本mysql, 参见以下: https://www.cnblogs.com/wishwzp/p/7113403.html