Suse Linux 10中MySql安装与配置步骤_MySQL
安装环境:
操作系统:suse Linux 10
数据库:MySQL 5.0.22
希望能认识更多高手,互相学习讨论技术!
首先发泄一下再这,网上看了N多安装mysql的文章,大多大同小异,都不能很好的安装mysql;多多少少都有问题;以个人之见大多为一份原文,拷贝到各自的博客或一些网上,纯属盗窃啊!上周末开始筹划安装suse以及mysql,一直到今天下午才终于到了show databases;太晕了!现在我将我安装mysql的每一步骤都放在这,以共需者查看,也以防日后自己再次观摩;
注意:在装suse linux时候一定选上C/C++开发那一项;听公司前辈说的。
具体安装步骤:
1.下载软件包mysql-5.0.22.tar.gz,地址http://www.mysql.com,一般不推荐安装rpm形式的;
2.把下载下来的mysql-5.0.22.tar.gz放在usr目录下并解压:
代码如下:
# tar zvxf mysql-5.0.22.tar.gz
3.# cd mysql-5.0.22 //进入解压缩后的文件目录;
4. ./configure --prefix=/usr/local/mysql --with-charset=gbk//设定安装目录,注意前面是./configure 点杠;
5.编译:# make //只是一个make就够了
6.安装:# make install //这两步都要一些时间
7.安装完添加一个mysql用户组并设置权限:
代码如下:
# useradd mysql
# cd /usr/local/mysql
# bin/mysql_install_db --user=msyql
# chown -R root:mysql .
# chown -R mysql var
# chgrp -R mysql .
# cp share/mysql/my-large.cnf /etc/my.cnf
看清楚有些后面是有个小点的;
8.设置开机自启动mysql服务:
代码如下:
# cp //usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
#chmod 755 /etc/init.d/mysql
#chkconfig --add mysql
# /etc/init.d/mysql start
我的linux是suse的,所以这里init.d是在etc下。其它的可能位置不一样;
然后重新启动系统:reboot 呵呵等吧
9.运行mysql
开机在终端进入mysql的目录:
启动服务:service mysql start
代码如下:
#cd /usr/local/mysql/bin
# ./mysql -u root -p
然后会提示Enter password:
输入你的密码即可进入mysql;
10.也可手动启动mysql服务:
代码如下:
# /usr/local/mysql/bin/mysqld_safe --user=root & //启动MySQL
11.修改密码:也可这样设置
# /usr/local/mysql/bin/mysqladmin -u root password “你的密码” //修改密码
12.关闭mysql服务:
代码如下:
# /usr/local/mysql/bin/mysqladmin -u root -pmysqlsecret shutdown //关闭MySQL
这样剩下的就只是数据库方面的操作了,哎松一口气,快晕死了!!
13.忘了卸载mysql的方法了补上:
进入mysql解压下的那个文件里
代码如下:
#cd /usr/mysql-5.0.22
#make uninstall
完成,最后要把那些不要的关于mysql文件夹删除了也可以,那就更彻底了!
代码如下:
mysql> grant all privileges on *.* to 'root'@'%'
-> identified by 'root' with grant option;
Query OK, 0 rows affected (0.05 sec)
mysql> select host,user from mysql.user;
+----------------+--------+
| host | user |
+----------------+--------+
| 192.168.61.113 | root |
| localhost | jason |
| localhost | prod |
| localhost | qsrock |
| localhost | radius |
| localhost | root |
+----------------+--------+
使用网上介绍的方法修改root用户的密码:
代码如下:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
代码如下:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:
mysql>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...
